Removing duplicate rows in vi?

后端 未结 14 2074
无人及你
无人及你 2021-01-29 23:10

I have a text file that contains a long list of entries (one on each line). Some of these are duplicates, and I would like to know if it is possible (and if so, how) to remove

14条回答
  •  春和景丽
    2021-01-29 23:42

    :%s/^\(.*\)\(\n\1\)\+$/\1/gec
    

    or

    :%s/^\(.*\)\(\n\1\)\+$/\1/ge
    

    this is my answer for you ,it can remove multiple duplicate lines and only keep one not remove !

提交回复
热议问题