Solaris Advanced User's Guide

Inserting One File Into Another

vi makes it convenient to “read” (insert) a file into the file you are editing. The general form of the command is:


: line# r filename

If you do not specify a line number, vi inserts the file at the current cursor position.

For example, if you wanted to insert the file orwell at line 84 of the file paint, you would type:


:84 r orwell

Or you could position the cursor on line 84 and type:


:r orwell