EX Commands
The
vi
editor you use the
vi
complete, but the commands given are the more commonly used. If more than one line is to be
modified by certain commands (such as
command. For example, to substitute lines 3 through 15, the command is
Table 20: EX commands
vi Command
:ab string strings
:map keys
new_seq
:q
:q!
:s/pattern/
to_pattern/
options
:set [all]
:una string
:unm keys
:vi filename
:w
:w filename
:w >> filename
:wq
7450 ESS OS Basic System Configuration Guide
editor is built upon another editor, called EX. The EX editor only edits by line. From the
command to start entering an EX command. This list given here is not
:
Abbreviation. If a word is typed in
automatically inserts the corresponding words. For example, the
abbreviation
words,
United States of America
in.
Mapping. This lets you map a key or a sequence of keys to another key or
a sequence of keys.
Quit
. If there have been changes made, the editor will issue a warning
vi
message.
Quit
without saving changes.
vi
Substitute. This substitutes the specified pattern with the string in the
to_pattern. Without options, it only substitutes the first occurrence of the
pattern. If a 'g' is specified, then all occurrences are substituted. For
example, the command
substitutes all occurrences of
Sets some customizing options to
gives all the possible options.
Removes the abbreviation previously defined by
Removes the remove mapping defined by
Starts editing a new file. If changes have not been saved, the editor will
give you a warning.
Write out the current file.
Write the buffer to the filename specified.
Append the contents of the buffer to the filename.
Write the buffer and quit.
and
) the range must be specified before the
:s
:w
Description
vi
:ab usa United States of America
:1,$s/Alcatel/Alcatel-Lucent/g
Alcatel
vi
CLI Usage
:3,15s/from/this/g
corresponding to string1, the editor
would insert the
whenever the word
usa
to
Alcatel-Lucent
and EX. The
:set all
.
:ab
.
:map
.
is typed
.
command
Page 51