Open System Services Shell and Utilities Reference Manual (G06.27+, H06.04+)
User Commands (d - f) ex(1)
e[dit][!][+line][file]
ex[!][+line][file]
Edits file. If the current buffer has been modified since the last write, the subcommand
writes a warning and terminates. You can override this action by appending the ! (excla-
mation point) character to the subcommand (for example, e! file).
If the +line argument is specified, the current line is the specified position, where line
can be a number (or $) or can be specified as /pattern or ?pattern. Preceding the pattern
with a / (slash) starts a search from the beginning of the file. Preceding the pattern with
a ? (question mark) starts a search from the end of the file. This subcommand is affected
by the autowrite and writeany editor options.
f[ile][file]
Writes the current pathname, the number of lines, and the current position (if no file
argument was specified). If file is specified, ex changes the current filename to file
without changing the contents of the buffer or the previous current file.
[range] g[lobal] /pattern/ [subcommands]
[range] v/pattern/ [subcommands]
Marks the lines within the given range that match (g) or do not match (v) the given pat-
tern. Then executes the ex subcommands with the current line set to each marked line.
You can specify multiple subcommands, one per line, by escaping each newline charac-
ter with a \ (backslash). If the subcommands argument is not specified, each line is writ-
ten. For the append, change, and insert subcommands, the input text is included as part
of the global subcommand; in this case, you can omit the terminating period if it ends
subcommands. The visual subcommand can be specified as part of subcommands.In
this mode, input is taken from the terminal. Entering a Q from visual mode selects the
next line matching the pattern and re-enters visual mode, until the list is exhausted.
You cannot use the global subcommand itelf and the undo subcommand in the subcom-
mands argument. The autoprint, autoindent, and report editor options are inhibited for
the duration of the g or v subcommand.
[line] i[nsert][!]
Enters input mode and places the input text before the specified line. The ! (exclamation
point) toggles the autoindent editor option setting for the execution of this subcom-
mand.
[range] j[oin][!][count][flags]
Joins the text from the specified lines together into one line. In the POSIX locale, when
the last character on the first line of a pair of lines to be joined is a . (period), two spaces
are added following the period; when the last character of the first line is a space or
when the first character on the second line of the pair is a ) (right parenthesis), no spaces
are added; otherwise, one space is added following the last character of the first line.
Extra spaces at the start of a line are discarded.
Appending a ! (exclamation point) character to the join subcommand causes a simpler
join with no whitespace processing, independent of the current locale.
[range] l[ist][count][flags]
Writes the addressed lines; nonprintable characters are written as multicharacter
sequences. The end of the line is marked with a $ (dollar sign).
Long lines are folded. The current line is the last line written.
527188-004 Hewlett-Packard Company 3−109