On uniq and sort


Here’s a quick tip for anyone using linux.

I ran into a situation tonight where I needed to consolidate a list of URL’s.  The URL’s were from different sources but served the same purpose, so it was quite likely that duplicates were present.  Assuming you’ve pasted the URL’s, one on each line, into the file list

cat list | sort | uniq > list-unique

Uniq returns only the unique entries, but requires a sorted list going in.
Alternately, if you want to see how many occurances of each URL:

cat list | sort | uniq | sort

Originally posted 2008-12-25 02:37:49.

Related Posts:

, , , , , ,

  1. No comments yet.
(will not be published)

Comments are closed.

Bad Behavior has blocked 211 access attempts in the last 7 days.

© 2008-2010 Learn With Harv: Blog All Rights Reserved -- Copyright notice by Blog Copyright

Learn With Harv: Blog is Digg proof thanks to caching by WP Super Cache