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. When first invoked, 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. This is the primary means of adding text to a file.
Lines consist of text up to and including a newline character.
It is possible to modify only a portion of a line by means of replacement, as in the example above. If fewer addresses are given than the command accepts, then default addresses are sup- plied. This should be used if ed 's standard input is from a script. The default filename is set to file only if it is not prefixed with a bang. An address represents the number of a line in the buffer.