Write Lines to Another File using Vim/Vi

This page answers questions like these:

Copy Specific Line Numbers from One File to Another File:

vim FILE1
:4,17w!FILE2

Copy Some Lines of One File to Another File:

vim FILE1
Move to any position on the first line you want to copy (using commands like j, /, %, etc.)
ma
Move to any position on the last line you want to copy (using commands like j, /, %, etc.)
:'a,.w!FILE2



Related Links:
Fold/Collapse/Hide Code Blocks in Vim
Expand/Show/Open Collapsed/Hidden/Folded Text in Vim
Replace with Confirmation in Vim

Home  >  Vim  >  Write Lines to Another File using Vim/Vi


Tags: replace, replace with confirmation, confirmation, confirm, replace with confirm, global replace, yes/no, vim

Src: vim-write-lines-to-file.txt
Dst: Vim/vim-write-lines-to-another-file.htm
Ads: 3