6. Command addressing
6.1. Addressing primitives
- .
-
The current line.
Most commands leave the current line as the last line which they affect.
The default address for most commands is the current line,
thus `.' is rarely used alone as an address.
- n
-
The nth line in the editor's buffer, lines being numbered
sequentially from 1.
- $
-
The last line in the buffer.
- %
-
An abbreviation for ``1,$'', the entire buffer.
- +n -n
-
An offset relative to the current buffer line.**
- /pat/ ?pat?
-
Scan forward and backward respectively for a line containing pat, a
regular expression (as defined below). The scans normally wrap around the end
of the buffer.
If all that is desired is to print the next line containing pat, then
the trailing / or ? may be omitted.
If pat is omitted or explicitly empty, then the last
regular expression specified is located.***
- '' 'x
-
Before each non-relative motion of the current line `.',
the previous current line is marked with a tag, subsequently referred to as
`'''.
This makes it easy to refer or return to this previous context.
Marks may also be established by the
mark
command, using single lower case letters
x
and the marked lines referred to as
`'x'.
6.2. Combining addressing primitives
Addresses to commands consist of a series of addressing primitives,
separated by `,' or `;'.
Such address lists are evaluated left-to-right.
When addresses are separated by `;' the current line `.'
is set to the value of the previous addressing expression
before the next address is interpreted.
If more addresses are given than the command requires,
then all but the last one or two are ignored.
If the command takes two addresses, the first addressed line must
precede the second in the buffer.**