How do I find duplicate rows in Unix?

Khánh Đoan

New member
How do I find duplicate rows in Unix?
Answer
How to find duplicate records of a file in Linux?
  1. Using sort and uniq: $ sort file | uniq -d Linux. …
  2. awk way of fetching duplicate lines: $ awk ‘{a[$0]++}END{for (i in a)if (a>1)print i;}’ file Linux. …
    [*] Using perl way: …
    [*] Another perl way: …
    [*] A shell script to fetch / find duplicate records:
 

Tìm kiếm

Back
Top