Open System Services Shell and Utilities Reference Manual (G06.29+, H06.08+, J06.03+)

ex(1) OSS Shell and Utilities Reference Manual
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
file and the last prior file 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 modified 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 flag and the filename.
You can edit a sequence or group of files. You can use the next subcommand to edit each
file on the command line in turn, or to specify a list of filenames to edit (using the shell
pattern matching syntax). The wildcard character % (percent sign) represents the name of
the current edit file and can be used to form filenames.
You can copy and move text within a file and between files (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 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.
You can use patterns that match words. A pattern can be a fixed 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 file gives you more flexibility than trying to locate a
fixed 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 specified line. The type argument is optional, and can be a -
(dash) or . (dot), as in the z subcommand, to specify the position of the specified line on
the screen window. (The default is to place the line at the top of the screen window.)
The count argument specifies 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.
3110 Hewlett-Packard Company 527188-021