The ex line editor serves as the foundation for the screen editor vi. Commands in ex work on the current line or on a range of lines in a file. Most often, you use ex from within vi. In vi, ex commands are preceded by a colon and entered by pressing ENTER.
You can also invoke ex on its
own—from the command line—just as you would invoke vi. (You could execute an ex script this way.) Or you can use the
Q to quit the vi editor and enter ex.
To enter an ex command from vi, type:
: indicates an
ex command. As you type the
command, it is echoed on the status line. Execute the command by
pressing the ENTER key. address is the line
number or range of lines that are the object of
command. options and
addresses are described below. ex commands are described in the section
"Alphabetical Summary of ex
You can exit ex in several ways:
Exit (save changes and quit).
Quit without saving changes.
Switch to the vi editor on the current file.
If no address is given, the current line is the object of the command. If the address specifies a range of lines, the format is:
where x and y are
the first and last addressed lines (x must
precede y in the buffer).
x and y may each be a line
number or a symbol. Using
, sets the current
line to x before interpreting
y. The notation
1,$ addresses all lines in the file, as
All lines in the file. ...