Operating System - Linux
1754357 Members
4522 Online
108813 Solutions
New Discussion юеВ

yank and paste by vi commands

 
SOLVED
Go to solution
Shivkumar
Super Advisor

yank and paste by vi commands

Hi,

I have opened 2 files rose and pink for editing by using the command $vi rose pink.

What are the vi commands to yank (copy) 15 lines in the buffer from file rose and paste them to another file pink ?

Thanks,
Shiv
4 REPLIES 4
Uday_S_Ankolekar
Honored Contributor

Re: yank and paste by vi commands

you should d a15yy on file 1 ( stores 15 lines in buffer a )

then ap in the second file


-USA..
Good Luck..
James R. Ferguson
Acclaimed Contributor
Solution

Re: yank and paste by vi commands

Hi Shiv:

This is all to familar. See your previous post and its responses:

http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=1076397&admit=-682735245+1173906853730+28353475

Regards!

...JRF...
hpuxrox
Respected Contributor

Re: yank and paste by vi commands

$vi rose pink <-- unix shell

15yy <--vi command mode

:n <-- vi last line mode

p <-- vi command mode

:x <-- vi last line mode

$ <-- UNIX shell

Done
Steven Schweda
Honored Contributor

Re: yank and paste by vi commands

Having to remember stuff like this for "vi"
is part of what makes "vim -g" popular.

http://www.vim.org/