Ex commands ex syntax – I.R.I.S. DC1100 User Manual
Page 58

Coaxial Networks, Inc.
Page 58 of 60
&
-- execute last ex-style substitution
.
-- execute last modification
!
object command -- send object as stdin to command and replace with
stdout
[Ctrl]-G
-- print information about file
:
map
x y -- when character x is pressed, execute y
:
map!
x y -- map input mode character x to string y
:
ab
x y -- x is an abbreviation for y, changes are made on the fly
:
su
-- Suspend the current editor session
:
sh
-- run a shell
ex Commands
ex syntax
ex commands in the vi follow this general form:
: Address command
Which means:
Execute command on specific lines obtained from the address part of the general form.
If address is omitted, current line is used. Keep in mind that the ex is a line-based editor; so all
actions are line based.
Addresses
:
% -- all lines in file
x,y -- lines x to y
. -- current line
n -- line number: n
$ -- last line of file
x-n -- n lines before line x
x+n -- n lines after line x
/pat/ -- forward to line containing pat
?pat? -- backward to line containing pat
Some commands are:
s/pat/text/ -- substitute 1
st
match of pat with text
s/pat/text/g -- substitute every match of pat with text
s/pat/text/n -- substitute the n
th
occurrence of pat with text
ya c -- yank into buffer c or the general buffer if c is omitted
g address cmd -- execute cmd on all lines which satisfy address
> -- shift right
< -- shift left
d -- delete line
! UNIX-cmd -- execute UNIX-cmd on line
m address -- move lines to address