vi allows to do just that. It is not that obvious, though.Simply move the cursor to the first line you want to write out to a file and use
m ain command mode, move the cursor to the last of the consecutive lines and use
m bagain, in command mode. To write the text between the two markers
a and b to a file, use the following command::'a,'b w filenameIf you want to keep the current filename and add an extension to it use
:'a,'b w %.backupvi will expand the % to the name of the current file and appends .backup to it.Easy, isn't it?

