Before you start off simply memorizing ex commands (or worse,
ignoring them), let's first take some of the mystery out of line editors.
Seeing how ex works when it is invoked directly will
help make sense of the sometimes obscure command syntax.
Open a file that is familiar to you and try a few ex
commands.
Just as you can invoke the vi editor on a file, you can
invoke the ex line editor on a file.
If you invoke ex,
you will see a message about the total number of lines in the file,
and a colon command prompt.
For example:
$ ex practice
"practice" 6 lines, 320 characters
:
You won't see any lines in the file unless you give an ex
command that causes one or more lines to be displayed.
:1
With a screen editor you can
:s/screen/line/
With a line editor you can
Notice that the changed line is reprinted after the command is issued.
You could also make the same change like this:
:1s/screen/line/
With a line editor you can
Even though you will be invoking ex commands from vi and
will not be using them directly, it is worthwhile to spend a few
minutes in ex itself.
You will get a feel for how you need to tell the editor which line
(or lines) to work on, as well as which command to execute.
After you have given a few ex commands on your
practice file, you should invoke vi on that same file,
so that you can see it in the more familiar visual mode.
The command :vi will get you from ex to vi.