How do I get unique records in Unix?

Trung Minh

New member
How do I get unique records in Unix?
Answer
Let us now see the different ways to find the duplicate record.
  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