Copy and paste content from one file to another file in vi

后端 未结 18 1506
南方客
南方客 2020-12-04 05:02

I am working with two files, and I need to copy a few lines from one file and paste into another file. I know how to copy (yy) and paste (p) in the same file. But that doesn

18条回答
  •  孤城傲影
    2020-12-04 05:12

    While editing the file, make marks where you want the start and end to be using

    ma - sets the a mark

    mb - sets the b mark

    Then, to copy that into another file, just use the w command:

    :'a,'bw /name/of/output/file.txt
    

提交回复
热议问题