## 17.11. Saving Part of a File

While editing, you will sometimes want to save just part of your file as a separate, new file. For example, you might have entered formatting codes and text that you want to use as a header for several files.

You can combine ex line addressing (Section 20.3) with the write command, `w`, to save part of a file. For example, if you are in the file practice and want to save part of practice as the file newfile, you could enter:

`:230,$w` `newfile`
  Saves from line 230 to end-of-file in newfile.
`:.,600w` `newfile`
  Saves from the current line to line 600 in newfile.

After newfile has been created, you'll need `w!` instead of `w`.

-- LL, from Learning the vi Editor (O'Reilly, 1998)

Copyright © 2003 O'Reilly & Associates. All rights reserved.