DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
Editing files

Including the contents of another file

To read a file into vi at the current cursor position, switch to command mode and press :r, then type the name of the file. If the file is readable, its contents will be inserted below the cursor.

You can use addresses with this command, including 0 to specify a dummy line before the first line in the file. For example, if you want to add the file preamble at the top of soliloquy, used in a previous example, you would enter :0r preamble to produce:

   Hamlet's soliloquy from Act III Scene 1:
   

To be, or not to be: that is the question: Whether 'tis nobler in the mind to suffer The slings and arrows of outrageous fortune, . . .

The command :r loads another copy of the last-saved version of the present file below the current line.
© 2004 The SCO Group, Inc. All rights reserved.
UnixWare 7 Release 7.1.4 - 22 April 2004