ED(1) BSD Reference Manual ED(1) ed - the standard text editor
ed [-] [-sx] [-p string] [file] ed is a line-oriented text
editor. It is used to create, display, modify, and otherwise
manipulate text files. If invoked with a file argument, then a
copy of file is read into the editor's buffer. Changes are made
to this copy and not directly to file itself. Upon quitting ed,
any changes not explicitly saved with a w command are lost.
Editing is done in two distinct modes: command and input. When
first in- voked, ed is in command mode. In this mode, commands
are read from the standard input and executed to manipulate the
contents of the editor buffer. A typical command might look
like: ,s/old/new/g which replaces all occurrences of the string
"old" with "new". When an input command, such as a (append), i
(insert), or c (change) is given, ed enters input mode. This is
the primary means of adding text to a file. In this mode, no
commands are available; instead, the standard input is written
directly to the editor bu