Importing Files into vi


Importing Files into vi

You can also merge multiple files in vi by reading additional files into the current one, as shown in Figure 4.13. Basically, all this means is that you insert one file into the file you're currently editing.

Figure 4.13. Reading an additional file into the current one can make your editing tasks much easier.


To Import Files in vi:

1.

vi hairyspider

At the shell prompt, type vi followed by the filename to start vi with, in this case, the hairyspider file.

2.

:r filename

At the point in the file where you want to import text, press , then type :r and the filename you want to read into the file.

Tip

  • vi also lets you read the output of commands into the file. For example, if you want to read the list of files in a specific directory into the file, use :r !ls in command mode.





Unix(c) Visual Quickstart Guide
UNIX, Third Edition
ISBN: 0321442458
EAN: 2147483647
Year: 2006
Pages: 251

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net