.\" This module is believed to contain source code proprietary to AT&T.
.\" Use and redistribution is subject to the Berkeley Software License
.\" Agreement and your Software Agreement with AT&T (Western Electric).
.\" @(#)e5 8.1 (Berkeley) 6/8/93
Change and Insert \- ``c'' and ``i''
This section discusses the
or replace a group of one or more lines,
which is used for inserting a group of one or more lines.
is used to replace a number of lines with different lines, which
are typed in at the terminal.
\&. . . \fItype the lines of text you want here\fP . . .
The lines you type between the
will take the place of the original lines between
This is most useful in replacing a line
or several lines which have errors in them.
If only one line is specified in the
(You can type in as many replacement lines as you like.)
input \- this works just like the
and must appear by itself on a new line.
If no line number is given, line dot is replaced.
The value of dot is set to the last line you typed in.
``Insert'' is similar to append \- for instance
\&. . . \fItype the lines to be inserted here\fP . . .
will insert the given text
the next line that contains ``string''.
If no line number is specified dot is used.
Dot is set to the last line inserted.
``Change'' is rather like a combination of
delete followed by insert.
Experiment to verify that
similar, but not the same.
Observe that if no line number is given,
inserts before line dot, while
Moving text around: the ``m'' command
is used for cutting and pasting \-
it lets you move a group of lines
from one place to another in the buffer.
Suppose you want to put the first three lines of the buffer at the end instead.
You could do it by saying:
but you can do it a lot easier with the
\fIstart line, end line\fP m \fIafter this line\fP
Notice that there is a third line to be specified \-
the place where the moved stuff gets put.
Of course the lines to be moved can be specified
you could reverse the two paragraphs like this:
/Second/,/end of second/m/First/\-1
Dot gets set to the last line moved.
The global commands ``g'' and ``v''
is used to execute one or more
commands on all those lines in the buffer
that match some specified string.
prints all lines that contain
makes the substitution everywhere on the line,
then prints each corrected line.
which only prints the last line substituted.
Another subtle difference is that
There may be several commands
every line except the last must end with a backslash
makes changes in the lines before and after each line
then prints all three lines.
except that the commands are executed on every line
match the string following
deletes every line that does not contain a blank.