Open System Services Shell and Utilities Reference Manual (G06.25+, H06.03+)
Table Of Contents
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 finds 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 finds 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 specifies an address plus or minus the indi-
cated number of lines. The + (plus sign) is optional.
• An address that begins with + or - specifies a line relative to the current line. For example,
-5 is the equivalent of .-5 (five lines above the current line).
• An address that ends with - or + specifies 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,$ (first 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
first 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 first must be numerically smaller than the
second.
The ed Limits
The following is a list of ed command size limitations:
• 64 bytes per filename.
• 512 bytes per line.
• 256 bytes per global subcommand list.
• 128-kilobyte buffer size. (Note that the buffer not only contains the original file 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
file 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-003 Hewlett-Packard Company 3−43