The Write Command
The Write command [:][w] will write all or part of the
Work Buffer
to a file. The syntax for the command is
- :[address]w[!] [filename]
If you do not use an address or a filename, the entire work buffer is
written to the file you are editing, hence it gives you a way of
permanently saving the changes you have made to your file without
actually exiting
from "vi" with the [Z][Z] command. The address is specified in the same
way as in the Substitute
command and specifies the portion of the Work Buffer to be written. If
no address is included, the entire Work Buffer is written. The
exclamation point is necessary unless you are writing out the entire
contents of the Work Buffer to the current file being edited. It
forces "vi" to perform the command. You are able to append to an
existing file by using the following form of the command:
Click here to go to
the top of the chapter.