OpenWindows Advanced User's Guide

6.9.2 Copying Lines Between Files

To copy lines from one file to another, do the following:

  1. Edit the first file.

  2. Save the desired lines in named buffers, using the yank command. For example, to save 10 lines in buffer a, type a10Y.

  3. Without exiting vi, edit the next file (orwell in this example):

    :n orwell
    

  4. Add the lines from the first file with the put command. For example, to put the contents of buffer a below the current cursor position, type ap.

Remember that the contents of all named buffers are lost whenever you exit vi. Don't use the quit (:q) command until you have finished any operations involving named buffers.