Monday, 3 February 2014

To find duplicate and distinct records

1. To display the number of occurrences and the records.

sort f1.txt | uniq -c
2 class
3 jar
1 bin

2.To display only the duplicate records.

sort f1.txt | uniq -d
class
jar

3.To display the distinct records

sort f1.txt | uniq
or
sort f1.txt | uniq -u

bin

No comments:

Post a Comment