[Chapter 30] 30.11 Keep Your Original File, Write to a New File
Author: Jerry Peek, Tim O'Reilly & Mike Loukides
Date: 1998-08-04T21:45:25Z

#

| Chapter 30 vi Tips and Tricks |

## 30.11 Keep Your Original File, Write to a New File

You can use `:w` to save an entire buffer (the copy of the file you are editing) under a new filename.

Suppose you have a file practice, containing 600 lines. You open the file and make extensive edits. You want to quit but save both the old version of practice and your new edits for comparison. To save the edited buffer in a file called check_me, give the command:

>     :w check_me

Your old version, in the file practice, remains unchanged (provided that you didn't previously use `:w`). You can now quit the old version by typing `:q`.

- LL from O'Reilly & Associates' Learning the vi Editor, Chapter 5

30.10 Confirming Substitutions in ex and vi |  | 30.12 Saving Part of a File