Editing text in ed
There are several commands for editing text in ed:
ed supports the same regular expressions as vi; see
``Editor regular expressions''.
For full details, see also
Appends text. If the file is new, you can only enter text
using this command. If the file already exists, specify an address (in
the form of a line number or search pattern) to select the line
to which to append text.
Changes text. This command requires the address(es) of the line(s)
to be replaced. When you finish entering new text,
press <Ctrl>D or ``.'' on a new line
to return to command mode.
Deletes text. This command requires the address(es) of the line(s)
to be deleted.
Inserts text. Whatever you type is inserted before the current
line; press <Ctrl>D or ``.'' on a new line
to stop inserting text and return to command mode.
Replaces text. ed replaces the first occurrence of
old on the line with new. The string old
can contain regular expressions, as with vi.
If you prefix this command with a range of addresses, each line
in the range is searched and the first instance of old
on each line is replaced with new. For example,
,s/foo/bar/g replaces every instance of ``foo''
on every line by the string ``bar''.
Cancels the effect of the previous command.
Moving around in ed
© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003