Monday, September 3, 2012

How do you get the duplicate/repeated lines in a file in UNIX?

uniq -d <FileName> # print only those lines which are repeated

uniq -c <FileName> # adds the number of occurrences of each line

uniq -u <FileName> # print only those lines which are not at all repeated

No comments :