//View Tip #246
Similar Tips
» Random IP addresses

 

Latest tips by RSS
Click here to subscribe
Follow Shell-Fu on Twitter
Click here to follow
Follow Shell-Fu on identi.ca
Click here to follow
You can use the 'uniq' command to handle duplicate lines in a file:

$ cat tst
a
a
b
c
c
d

$ uniq -d tst //show duplicated lines a c
$ uniq -u tst //show unique lines b d
$ uniq tst //remove duplicates a b c d


View Comments »




Comments 

Add your comment

Comments are currently disabled
Madelaine
Make sure the file is sorted, or it won't work.
Posted 2009-05-19 14:58:58

Home Latest Browse Top 25 Random Hall Of Fame Contact Submit