UNIX Power Tools

UNIX Power ToolsSearch this book
Previous: 30.10 Confirming Substitutions in ex and viChapter 30
vi Tips and Tricks
Next: 30.12 Saving Part of a File
 

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


Previous: 30.10 Confirming Substitutions in ex and viUNIX Power ToolsNext: 30.12 Saving Part of a File
30.10 Confirming Substitutions in ex and viBook Index30.12 Saving Part of a File

The UNIX CD Bookshelf NavigationThe UNIX CD BookshelfUNIX Power ToolsUNIX in a NutshellLearning the vi Editorsed & awkLearning the Korn ShellLearning the UNIX Operating System