Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ ex(1) — AIX PS/2 1.2.1

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

vi, vedit, view

edit

ctags

awk, nawk, oawk

ed, red

grep, egrep, fgrep

sed



EX(1,C)                     AIX Commands Reference                      EX(1,C)



-------------------------------------------------------------------------------
ex



PURPOSE

Edits lines interactively with screen display.

SYNTAX


      +------------+   +--------+   +------------------+
ex ---| +--------+ |---| one of |---|     +----------+ |--->
      +-| -l     |-+   | +----+ |   +- + -|1         |-+
        | -R     |     +-| -v |-+         +- subcmd -+
        | -t tag |       | -  |
        | -w num |       +----+
        +--------+

    +-----------------+   +------------+
>---|      +--------+ |---|            |---|
    +- -r -|        |-+   +--- file ---+
           +- file -+       ^        |
                            +--------+


-----------------
1 Do not put a blank between these items.


DESCRIPTION

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 displays and access to a screen editing mode.  You may prefer to
call vi directly to have environmental variables 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:





Processed November 8, 1990          EX(1,C)                                   1





EX(1,C)                     AIX Commands Reference                      EX(1,C)



  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.  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
    it's 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 accepts.  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.  The buffer names can contain only ASCII digits.

  o You can use patterns that match words.  For example, you can search only
    for the word "ink" when your document also contains the word "inkblot" or
    "blink".  The patterns can contain Japanese characters.

  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 and execute a file of subcommands.  Nesting of source files is
    permitted, allowing one file to call another; however, no return mechanism
    is provided.





Processed November 8, 1990          EX(1,C)                                   2





EX(1,C)                     AIX Commands Reference                      EX(1,C)



The ex editor has the following maximum limits.  If have selected a language
(through the LANG environment variable) that supports multibyte characters, the
character limits can be reduced by as much as 50%, depending on the character
code set being used.

  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 128 map macros with 2048 characters total
  o 100 characters per each map macro subcommand (or rhs).

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.

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.

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
                      (Ctrl-C).

                      Note:  This editing state applies only to the RT PC.

PARAMETERS

The following is a list of the ex subcommands.  Most of these subcommands are
discussed under "edit" or "vi, vedit, view."

ab     abbrev    n     next      una   unabbrev
a      append    nu    number    u     undo
ar     args                      unm   unmap
c      change    pre   preserve
co     copy      p     print     vi    visual
d      delete    pu    put       w     write
e      edit      q     quit      x     exit



Processed November 8, 1990          EX(1,C)                                   3





EX(1,C)                     AIX Commands Reference                      EX(1,C)



f      file      re    read      ya    yank
g      global    rec   recover   z     window
i      insert    rew   rewind    !     escape
j      join      se    set       <     lshift
l      list      sh    shell     CR    print next
map    map       so    source    &     resubst
ma     mark      >     rshift
m      move      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 pat at
                    line                             end of line
           "%"      The first through       /^pat    The next line with pat at
                    last lines                       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, inclusive
*                     Any number of the preceding character.

FLAGS

-l                    Indents appropriately for Lisp code, and modifies the
                      functions of the () {} [ and ] characters when used 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 if you are an ordinary user.






Processed November 8, 1990          EX(1,C)                                   4





EX(1,C)                     AIX Commands Reference                      EX(1,C)



-t  tag               Loads the file that contains tag and positions the editor
                      at tag.  The tag can contain only ASCII characters.

-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 subcom 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.

-w num                Defines the number of lines desired in the window.  The
                      num variable can contain only ASCII characters.

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

See the following commands:  "vi, vedit, view,"  "edit," "ctags"  "awk, nawk,
oawk," "ed, red,"  "grep, egrep, fgrep," and  "sed."

See curses subroutine and the TERM and terminfo files in AIX Operating System
Technical Reference.














Processed November 8, 1990          EX(1,C)                                   5



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