Posts Tagged ‘Vi’

How to: Copy contents from file to file in VI editor

Thursday, April 10th, 2008

Here is the tip to copy contents from one file to another.

1. Press ‘ESC’.
2. Press Shift+” (double quote).
3. Press ‘a’.
4. Press number of lines you want to copy.
5. Press y followed by another y (yy).
6. Now press : (COLON) to get the vi prompt.
7. Hit e “destination file name’
8. Once you enter the destination file, go to the line where you want the copied lines to be inserted.
9. Press ‘ESC’.
10. Press Shift+”(double quote).
11. Press ‘a’.
12  Press ‘p’.

Happy editing :-)