- To begin editing a new file, enter:
ed filename
where filename is the name of a new file.
- After you see the ?filename message, enter:
a
This indicates that you want to append lines.
- Type your text. At the end of each line, press <Enter>. You can
then enter more text.
- When you have finished entering text, enter:
.
(a
period) at the start of a new line.
- To write the contents of the edit buffer to the file filename,
enter:
w
After writing to the file, the shell displays the
number of characters that were copied—for example, 746. This
number includes blanks and newline characters appended to each line
of text, which you cannot see on the screen.
If you want to write
to a file different from the original filename, specify a
different filename when you enter the w subcommand;
for example:
w diffname
Entering the w subcommand
does not change the contents of the buffer.
- To exit the ed program, enter:
q
This deletes
the contents of the buffer.
|