Tuesday, October 4, 2011

Remove duplicate lines with uniq

sort file.txt | uniq

To list the unique lines only: sort file.txt | uniq -u
To list the duplicated lines only: sort file.txt | uniq -d

No comments: