Open System Services Shell and Utilities Reference Manual (G06.28+, H06.05+)

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 le through the specied shell command (causes no change to the le).
:!command
Runs command, then returns.
:!! Repeats the last :!command command.
n!!command
Executes the shell command identied by command and replaces the number of lines
specied by n with the output of command.Ifn is not specied, the default is 1. If
command expects standard input, the lines specied 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 le).
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 le. If you are using this subcommand from the ex editor, you do not need to type
the : (colon).
:e! Reedits the current le and discards all changes.
:e + file Edits le, starting at the end.
:e +number
Edits le, starting at the line number.
:e # and <Ctrl-a>
Edits the alternate le. The alternate le is usually the previous current lename.
However, if changes are pending on the current le when a new le is called, the new
le becomes the alternate le.
:r file Reads the le 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 identied by command and places its output in the le by
adding new lines below the current cursor position.
527188-007 Hewlett-Packard Company 1015