Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ ex(1) — AIX/RT 2.2.1

Media Vault

Software Library

Restoration Projects

Artifacts Sought

ex

PURPOSE

     Edits lines interactively, with screen display.

SYNOPSIS
     ex [ - ] [ -v ] [ -t tag ] [ -r ] [ -R ] [ + command ] [ -l ] names


DESCRIPTION

     Warning:  The  ex command does not  support international
     characters.  If you use this  command to edit a file that
     contains extended characters, you may lose data.

     The ex command  is a line-oriented text editor  that is a
     subset of the vi screen editor.  The ex editor is similar
     to ed,  but is  more powerful, providing  multi-line dis-
     plays  and access  to  a screen  editing  mode.  You  may
     prefer to  call vi  directly to have  environmental vari-
     ables  set  for screen  editing.   Also  edit, a  limited
     subset of ex, is available for novice or casual use.  For
     more information on vi, see  "vi, vedit, view."  For more
     information on  edit, see "edit."

     Notes:

     1.  Some vi subcommands have meanings that differ from ed
         subcommands.

     2.  To  determine how  to  drive your  work station  more
         efficiently, ex uses the work station capability data
         base terminfo  and the type  of the work  station you
         are using from the shell environment variable TERM.

     The ex editor has the following features:

     o   You can  view text in  files.  The z  subcommand lets
         you  access  windows  of  text, and  you  can  scroll
         through text  by pressing Ctrl-D and  Ctrl-U.  The vi

         subcommand  provides  further   viewing  options  and
         active screen-editing by invoking the vi editor.
     o   You  can  you  revoke the  last  previous  subcommand
         entered (except  for q  and w).  The  undo subcommand
         allows you to "undo" the last subcommand, even if its
         an  undo subcommand.   Thus you  can switch  back and
         forth between the latest change  in the edit file and
         the last prior  file status and view the  effect of a
         subcommand without that  effect being permanent.  The
         ex command displays changed  lines and indicates when
         more than a  few lines are affected  by a subcommand.
         The undo  subcommand causes all  marks to be  lost on
         lines changed  and then restored if  the marked lines
         were  changed.    It  does  not  clear   the  "buffer
         modified" condition.
     o   You can retrieve your  work (except changes that were
         in the buffer) if the system or the editor crashes by
         re-entering the editor with the  -r flag and the file
         name.  When the file name  is not specified, all open
         files in your partition are listed.
     o   You can queue  a sequence or group of  files to edit.
         You can list the files in the ex command and then use
         the next subcommand to access each file sequentially.
         Or after you enter the editor, you can enter the next
         subcommand with a list of file names or a pattern (as
         used by  the shell)  to specify a  set of  files.  In
         general, you  can designate file names  to the editor
         using  the pattern-matching  symbols  that the  shell
         will accept.  You can use the wild card character "%"
         to  form file  names and  represent the  name of  the
         current edit file.
     o   You  can use  a  group of  buffers  (buffers named  a
         through z)  to move text  between files and  within a
         file.   You  can  temporarily  place  text  in  these
         buffers and copy or reinsert it in a file, or you can
         carry  it  over to  another  file.   The buffers  are
         cleared when  you quit  the editor.  The  editor does
         not notify you if text is  placed in a buffer and not
         used before exiting the editor.
     o   You can use patterns  that match words.  For example,
         you can search only for the word "ink" when your doc-
         ument also contains the word "inkblot" or "blink."
     o   You can  display a  window of  logical lines.   The z
         subcommand allows  you to select the  number of lines
         displayed  and locate  the  current  line within  the
         display simultaneously.  More than a screen of output
         can result  when the file  lines are longer  than the
         output  display  lines  because  the  set  number  of
         logical lines  are displayed rather than  a number of
         physical lines.
     o   You can  read a file  of editor subcommands.   The so
         command  allows you  to read  a file  of subcommands.
         Nesting of  source files  is permitted,  allowing one
         file to call another; however, no return mechanism is
         provided.

     The ex editor has the following maximum limits:

     o   1024 characters per line
     o   256 characters per global command list
     o   128 characters  in the previous inserted  and deleted
         text
     o   100 characters in a shell escape command
     o   63 characters in a string-valued option
     o   30 characters in a tag name
     o   250,000 lines  of 1024  characters per  line silently
         enforced
     o   32 map macros with 512 characters total.

       Editing States

     command  Normal and initial state.  Input is prompted for
              by  : (colon).   Pressing END  OF FILE  (Ctrl-D)
              clears  an   uncompleted  subcommand   from  the
              command line.
     entry    Entered by  a, i and  c.  In this state  you can
              enter text.   Entry state  ends normally  with a
              line that  has only a  . (period) on it  or ends
              abnormally if you press INTERRUPT (Alt-Pause).
     visual   Entered  by vi,  vi., vi-,  or o.   Each of  the
              first three commands gives  you a full screen vi
              editor, but puts the current line in a different
              place  on entry.   Enter vi  to put  the current
              line at the top of  the screen; enter vi. to put
              the current  line in  the middle of  the screen;
              and enter  vi- to  put the  current line  at the
              bottom of the screen.  The o command opens a one
              line window.  All three commands share the input
              state of  the visual editor.  Press  the Esc key
              to exit  the input state.   To return to  the ex
              command state at the current line, enter Q or ^\
              while not in the input state.

SUBCOMMANDS

     The following  table lists  the ex subcommands.   Most of
     these  subcommands are  discussed under  "edit"  or  "vi,
     vedit, view."

ab   abbrev        m    move          una  unabbrev
a    append        n    next          u    undo
ar   args          nu   number        unm  unmap
c    change        pre  preserve      vi   visual
co   copy          p    print         w    write
d    delete        pu   put           x    exit
e    edit          q    quit          ya   yank
f    file          re   read          z    window
g    global        rec  recover       !    escape
i    insert        rew  rewind        <    lshift
j    join          se   set           CR   print next
l    list          sh   shell         &    resubst
map  map           so   source        >    rshift
ma   mark          s    substitute    ^D   scroll

            Subcommand Addresses

                             "$"     The last line          x-num   The numth line before
                                                                    x
                             +       The next line          x,y     Lines x through y
                             -       The previous line      'm      The line  marked with
                                                                    m
                             + num   The     numth    line  ''      The previous context
                                     forward
                             -num    The   numth  previous  /$pat   The  next  line  with
                                     line                           pat at end of line
                             "%"     The   first   through  /^pat   The  next  line  with
                                     last lines                     pat at start of line
                             num     line num               /pat    The  next  line  with
                                                                    pat
                             .       The current line       ?pat    The   previous   line
                                                                    with pat

            Scanning Pattern Formation

            ^          The beginning of the line
            $          The end of the line
            .          Any character
            \<         The beginning of the word
            \>         The end of the word
            [string]   Any character in string
            [^string]  Any character not in string
            [x-y]      Any character  between x and  y, inclu-
                       sive
            *          Any number of the preceding character.

     FLAGS

     -l       Indents appropriately for Lisp code, and accepts
              the ()  {} [[ and  ]] characters as  text rather
              than interpreting  them as vi  subcommands.  The
              Lisp modifier is active in open or visual modes.
     -r  [file] Recovers file after an editor or system crash.
              If you do not specify  file, a list of all saved
              files is displayed.
     -R       The readonly option is  set, preventing you from
              altering the file.
     -t  tag  Loads the  file that contains tag  and positions
              the editor at tag.
     -v       Invokes the visual editor.

              Note:  When the v  flag is selected, an enlarged
              set  of  subcommands  are  available,  including
              screen  editing  and cursor  movement  features.
              See "vi, vedit, view."
     -        Suppresses  all  interactive-user feedback.   If
              you use  this flag, file input/output  errors do
              not generate a helpful error message.
     +subcmd  Begins the  edit at the specified  editor search
              or subcommand.   When subcomand is  not entered,
              +places the  current line  to the bottom  of the
              file.   Normally ex  sets  current  line to  the

              start of the  file, or to some  specified tag or
              pattern.

     FILES

     /usr/lib/exrecover        Recover subcommand.
     /usr/lib/expreserve       Preserve subcommand.
     /usr/lib/*/*              Describes capabilities  of work
                               stations.
     $HOME/.exrc               Editor startup file.
     ./.exrc                   Editor startup file.
     /tmp/Exnnnnn              Editor temporary.
     /tmp/Rxnnnnn              Names buffer temporary.
     /usr/preserve             Preservation directory.

     RELATED INFORMATION

     The  following  commands:   "vi, vedit,  view,"   "edit,"
     "awk,"  "ed,"  "grep," and "sed."

     The curses  subroutine and  the TERM, INIT,  and terminfo
     files in AIX Operating System Technical Reference.

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026