Removing duplicate rows in vi?

后端 未结 14 2034
无人及你
无人及你 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-30 00:02

    If you're OK with sorting your file, you can use:

    :sort u
    
    0 讨论(0)
  • 2021-01-30 00:05

    An alternative method that does not use vi/vim (for very large files), is from the Linux command line use sort and uniq:

    sort {file-name} | uniq -u
    
    0 讨论(0)
提交回复
热议问题