Removing duplicate rows in vi?

后端 未结 14 2042
无人及你
无人及你 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:49

    This worked for me for both .csv and .txt

    awk '!seen[$0]++' >

    Explanation: The first part of the command prints unique rows and the second part i.e. after the middle arrow is to save the output of the first part.

    awk '!seen[$0]++'

    >

提交回复
热议问题