Open System Services Shell and Utilities Reference Manual (G06.27+, H06.04+)

User Commands (d - f) ed(1)
. (dot) addresses the current line.
$ addresses the last line of the buffer.
n addresses the nth line of the buffer.
´x addresses the line marked with a lowercase letter, x, by the k subcommand.
/pattern/ addresses the next line that contains a matching string. The search begins with
the line after the current line and stops when it nds a match for the pattern. If necessary,
the search moves to the end of the buffer, wraps around to the beginning of the buffer, and
continues until it either nds a match or returns to the current line.
?pattern? addresses the previous line that contains a match for the pattern. The ?pattern?
construct, like /pattern/, can search the entire buffer, but it does so in the opposite direc-
tion.
An address followed by +number or -number species an address plus or minus the indi-
cated number of lines. The + (plus sign) is optional.
An address that begins with + or - species a line relative to the current line. For example,
-5 is the equivalent of .-5 (ve lines above the current line).
An address that ends with - or + species the line immediately before (-) or immediately
after (+) the addressed line. Used alone, the + character addresses the line immediately
before the current line. The + character addresses the line immediately after the current
line; however, the + character is optional. The + and - characters have a cumulative
effect; for example, the address --*O addresses the line two lines above the current line.
For convenience, a , (comma) stands for the address pair 1,$ (rst line through last line)
and a ; (semicolon) stands for the pair .,$ (current line through last line).
Commands that do not accept addresses regard the presence of an address as an error. Commands
that do accept addresses can use either given or default addresses. When given more addresses
than it accepts, a command uses the last (rightmost) ones.
In most cases, a , (comma) separates addresses (for example 2,8). A ; (semicolon) can also
separate addresses. A ; between addresses causes the ed command to set the current line to the
rst address and then calculate the second address (for example, to set the starting line for a search
based on guidelines 5 and 6). In a pair of addresses, the rst must be numerically smaller than the
second.
The ed Limits
The following is a list of ed command size limitations:
64 bytes per lename.
512 bytes per line.
256 bytes per global subcommand list.
128-kilobyte buffer size. (Note that the buffer not only contains the original le but also
editing information. Each line occupies one word in the buffer.)
The maximum number of lines depends on the amount of memory available to you. The maximum
le size depends on the amount of physical data storage (disk or tape drive) available or on the
maximum number of lines permitted in user memory.
SUBCOMMANDS
527188-004 Hewlett-Packard Company 343