[olug] Unix Tip: VI COPING BETWEEN FILES

Unix Guru Universe listserv at ugu.com
Mon Jun 2 15:35:41 UTC 2003


=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

			      UNIX GURU UNIVERSE 
			         UNIX HOT TIP

			Unix Tip 1979 - June  2, 2003

		    http://www.ugu.com/sui/ugu/show?tip.today

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=


VI COPING BETWEEN FILES

VI editor is a very powerful editor. 
Suppose you want to copy
line numbers 1-10 and 23-77 of 
file A and paste them on file B at 
the same time, what will
you do ?? Here I am giving a tip 
to do this :- 

Place the cursor on line no. 1
Press ESCAPE
Press Shift "(Shift double quotes)
Press a
Press 10yy [the number of lines you 
want to copy]

Now place the cursor on line no. 23
Press ESCAPE
Press Shift "(Shift double quotes)
Press b
Press 55yy [the number of lines you 
want to copy]

Now the first 10 lines have been 
copied in buffer "a" and next
55 lines have been copied in 
buffer "b".

Now press " : " (COLON) to get 
the vi prompt.
Hit e "Destination file name"

Once you enter the Destination file 
go to the line where you
want the first 10 lines in buffer 
"a" to be inserted.

Press ESCAPE.
Press Shift "(Shift double quotes)
Press a.
Press p.

The first 10 lines in buffer "a" 
gets inserted.

Now go to the line where you want the 
rest 55 lines in buffer
"b" to be inserted.

Press ESCAPE.
Press Shift "(Shift double quotes)
Press b.
Press p.

The rest 55 lines in buffer "b" 
gets inserted.


This tip generously supported by: ardhendu99 at yahoo.com


--------------------------------------------------------------------------
To Subscribe:    http://www.ugu.com/sui/ugu/show?tip.subscribe
To Unsubscribe:  http://www.ugu.com/sui/ugu/show?tip.unsubscribe
To Submit A Tip: http://www.ugu.com/sui/ugu/show?tip.today

==========================================================================
DISCLAIMER: All UNIX HOT TIPS ARE OWNED BY THE UNIX GURU UNIVERSE AND ARE
NOT TO BE SOLD, PRINTED OR USED WITHOUT THE WRITTEN CONSENT OF THE UNIX 
GURU UNIVERSE. ALL TIPS ARE "USE AT YOUR OWN RISK". UGU  ADVISES THAT 
ALL TIPS BE TESTED IN A NON-PRODUCTION DEVELOPMENT ENVIRONMENT FIRST.

Unix Guru Universe - www.ugu.com - tips at ugu.com - Copyright 1994-2001
==========================================================================



More information about the OLUG mailing list