Contact:[email protected]
Inserting Files in a Document Using vi When editing a document with vi, the contents of another text file can be retrieved and inserted into the file at the cursor's position. This is done by calling the 'r' function in the following format: :r <file> For example, while editing a document, after pressing escape to ensure that vi is accepting commands, the contents of the file 'tuneup' will be inserted at the point of the cursor by typing: :r /home/linux.com/tuneup the :r command can also be used in a much more powerfull way : :r!<command> This would insert the result of the <command> will be inserted just after the cursor. For example, if you want to insert the name of all the file in the current directory, you can use: :r!ls Or you can insert the current date and hour with: :r!date Back to the Index