Our Geeky Side
Sunday, 4 September 2011
QuickBits-8: Remove Duplicate Lines in a File
To Remove duplicate lines in a file and print it
cat filename | sort | uniq
sort
will sort the lines and
uniq
will remove adjacent duplicate lines.
To count the number of repetition of each line
cat filename | sort | uniq -c
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment