Duplicate each line in VI

前端 未结 3 1859
失恋的感觉
失恋的感觉 2021-01-31 18:22

I have a file with these lines:

aa
bb
cc
dd

I want to convert this into:

aa
aa
bb
bb
cc
cc
dd
dd

Is this poss

3条回答
  •  终归单人心
    2021-01-31 18:34

    Try this simple one:

    :g/^/norm yyp
    

    Yet another one(shorter):

    :%s/.*/&\r&
    

    Another one:

    :%!sed p
    

提交回复
热议问题