Open System Services Shell and Utilities Reference Manual (G06.27+, H06.04+)

User Commands (d - f) ex(1)
The undo subcommand allows you to reverse the last subcommand, even if it is an undo
subcommand. Thus, you can switch back and forth between the latest change in the edit
le and the last prior le status and view the effect of a subcommand without that effect
being permanent. Commands that affect the external environment cannot be undone, how-
ever. 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 modied condition.
You can retrieve your work (except changes that were in the buffer) if the system or the
editor crashes by reentering the editor with the -r ag and the lename.
You can edit a sequence or group of les. You can use the next subcommand to edit each
le on the command line in turn, or to specify a list of lenames to edit (using the shell
pattern matching syntax). The wildcard character % (percent sign) represents the name of
the current edit le and can be used to form lenames.
You can copy and move text within a le and between les (see the co, d, ya, and pu sub-
commands). You use a group of buffers (that have the names of the ASCII letter a to z)to
move text. You can temporarily place text in these buffers and copy or reinsert it in a le,
or you can carry it over to another le. 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.
You can use patterns that match words. A pattern can be a xed character string or a regu-
lar expression.
A regular expression is a string constructed of special pattern-matching characters. Using
a regular expression to locate text in a le gives you more exibility than trying to locate a
xed character string. For more information about regular expressions, see grep.
Editing Modes
Command mode
When you start the ex editor, it is in command mode. Enter ex subcommands at the :
(colon) prompt.
Text entry mode
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 abruptly if you press the Interrupt key
sequence.
Visual and open mode
To use visual mode, use the following syntax:
line vi [type][count]
Enters visual mode at the specied line. The type argument is optional, and can be a -
(dash) or . (dot), as in the z subcommand, to specify the position of the specied line on
the screen window. (The default is to place the line at the top of the screen window.)
The count argument species an initial window size; the default is the value of the win-
dow option. The Q subcommand exits visual mode. For more information, see vi.
The o command opens a one-line window. All three commands share the input state of
the vi editor. Press <Esc> to exit text entry mode. To return to the ex command state at
the current line, enter Q while in command mode.
527188-004 Hewlett-Packard Company 3107