Skip to contentSkip to conversation

copying lines from one file to another using vi

DISCUSSION John Holp 2 participants 2 messages Feb 6, 2010

lore
Share & tools
lore

John Holp

author
#0 lore raw

Redhat wizards,

I am doing good with auditing but want to copy key lines from example files into /etc/audit/audit.rules

What is the vi/vim syntax to copy lines from one file and post them into another file - i.e. my audit.rules file?

5yy appears to yank the current line and 4 more and one can paste the buffered lines into the same file but I want to pass the lines to a different file.

:h file_name I recall from along ago but that is for an entire file - I think:

Please help me to copy files from sample auditing files into my real "audit.rules".

Thanks,

John

#1 lore raw
Quoted 11 lines · John Holp

Redhat wizards,

I am doing good with auditing but want to copy key lines from example files into /etc/audit/audit.rules

What is the vi/vim syntax to copy lines from one file and post them into another file - i.e. my audit.rules file?

5yy appears to yank the current line and 4 more and one can paste the buffered lines into the same file but I want to pass the lines to a different file.

:h file_name I recall from along ago but that is for an entire file - I think:

Please help me to copy files from sample auditing files into my real "audit.rules".

Switch to another file, then paste there... The most portable way is :n <filename><CR>
but in almost all vi variants there's a way to split the window and open a new file there. For nvi that would be
:Vi <filename><CR>
for vim - :split <filename><CR>
and switching between those subwindows is
^W
in nvi an
^Ww
in vim.