#print Misc. Useful Features - The Outer Editor II When you invoke vi, you execute a command like 'vi '. If you want to look at several files, one at a time, you can use a command like vi ... This would be equivalent to running vi on each file separately. Once you've done this, however, how to you tell vi to go on to the next file? You use the ':n' command, of course. If you have made changes that you don't care about saving, you'll have to type ':n!'. Often, you'll want to read in another file and have its contents inserted into the file at a certain point. For this vi has the ':r' command. Just say ':r ' and vi will insert that file into yours at the current line. Finally, if you're inside vi and want to execute a normal shell command, just type :! where is the command you want to execute. You can try these commands out on your own. Once again, you can find out more by doing the 'learn editor' sequence. Type 'vi junk stuff' to practice with ex. # cp %s/longtext longtext #create junk You have entered vi with two files. Before going on to the next one you may be interested to know that whenever you are in vi, you can get into ex by typing Q. The cursor will move to the bottom of the screen and you will have a permanent colon prompt sign. You can always get from ex back into vi with the command 'vi' followed by the return key (this time you do not type in a file name). Try that now: type Q to get to ex, and then vi to get back to vi. Now type :n to move on to edit the next file. #create stuff This is the next file and is very short. There is a file called 'longtext', a copy of which you can read into this file after the current line by typing ':r longtext'. Put the cursor on this line and try that, then type :wq and 'ready'. #user #next 6.4 10