commandlinefu.com is the place to record those command-line gems that you return to again and again.
You can sign-in using OpenID credentials, or register a traditional username and password.
Subscribe to the feed for:
I used to do this sorting with:
sort file.txt | uniq -c | sort -nr
But this would cause the line (2nd column) to be sorted in descending (reverse) order as well sa the 1st column. So this will ensure the 2nd column is in ascending alphabetical order.
There are 8 alternatives - vote for the best!
If you can do better, submit your command here.
You must be signed in to comment.