Go to the previous, next section.
An address represents the number of a line in the buffer. ed
maintains a current address which is typically supplied to
commands as the default address when none is specified. When a file is
first read, the current address is set to the last line of the file. In
general, the current address is set to the last line affected by a
command.
A line address is constructed from one of the bases in the list below, optionally followed by a numeric offset. The offset may include any combination of digits, operators (i.e., `+', `-' and `^') and whitespace. Addresses are read from left to right, and their values are computed relative to the current address.
One exception to the rule that addresses represent line numbers is the address `0' (zero). This means "before the first line," and is legal wherever it makes sense.
An address range is two addresses separated either by a comma or semicolon. The value of the first address in a range cannot exceed the value of the the second. If only one address is given in a range, then the second address is set to the given address. If an n-tuple of addresses is given where n > 2, then the corresponding range is determined by the last two addresses in the n-tuple. If only one address is expected, then the last address is used.
Each address in a comma-delimited range is interpreted relative to the current address. In a semicolon-delimited range, the first address is used to set the current address, and the second address is interpreted relative to the first.
The following address symbols are recognized.
.
$
n
-
^
-n
^n
+
+n
whitespace n
,
%
;
/re/
?re?
'lc
Go to the previous, next section.