Script to find duplicates in a csv file

前端 未结 5 1131
旧巷少年郎
旧巷少年郎 2021-01-17 17:02

I have a 40 MB csv file with 50,000 records. Its a giant product listing. Each row has close to 20 fields. [Item#, UPC, Desc, etc]

How can I,

a) Find and Pri

5条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-01-17 17:29

    Try the following:

    # Sort before using the uniq command
    sort largefile.csv | sort | uniq -d
    

    uniq is a very basic command and only reports uniqueness / duplicates that are next to each other.

提交回复
热议问题