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

User Commands (v - z) vi(1)
:q Quits vi. If you have changed the contents of the editing buffer, vi displays a warning
message and does not quit.
:q! Quits vi, discarding the editing buffer with no warning.
:sh Runs a shell. You can return to vi by pressing <Ctrl-d>.
:w !command
Runs the file through the specified shell command (causes no change to the file).
:!command
Runs command, then returns.
:!! Repeats the last :!command command.
n!!command
Executes the shell command identified by command and replaces the number of lines
specified by n with the output of command.Ifn is not specified, the default is 1. If
command expects standard input, the lines specified are used as input. (10!!sort sorts
the next 10 lines.)
!linescommand
Works like n!!command, except that lines is a line address (for example, !Gsort sorts
the rest of the file).
Quit key sequence
Interrupts a subcommand.
Editing a Second File
Enter the following subcommands in Command mode. An incomplete subcommand can be can-
celled by pressing <Esc>.
:e file Edits file . If you are using this subcommand from the ex editor, you do not need to type
the : (colon).
:e! Reedits the current file and discards all changes.
:e + file Edits file, starting at the end.
:e +numbe r
Edits file, starting at the line number.
:e # and <Ctrl-a>
Edits the alternate file. The alternate file is usually the previous current filename.
However, if changes are pending on the current file when a new file is called, the new
file becomes the alternate file.
:r file Reads the file into the editing buffer by adding new lines below the current line. If you
are using this subcommand from the ex editor, you do not need to type the : (colon).
:r !command
Runs the shell command identified by
command and
places its output in the file by
adding new lines below the current cursor position.
527188-021 Hewlett-Packard Company 1015