Duplicate each line in VI

前端 未结 3 1847
失恋的感觉
失恋的感觉 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:41

    I like g/^/t.
    The g (for global) command will look for any lines that match a pattern.
    The pattern we specified is ^, which will match all lines.
    t will copy and paste, and finally
    the dot tells it to paste below.

    Do I win for brevity?

提交回复
热议问题