Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I've been doing | sort | uniq -c | sort -n for years! Just wondering if somewhere buried in the command stack that people have been updating for years if there is a simple alternative.

share|improve this question
    
What do you want to achive? Any kind of improvement or just type less? –  ghm1014 Mar 14 '12 at 18:11

1 Answer 1

up vote 1 down vote accepted

Maybe name it quniqsort? Mindset of Unix: keeping it simple and chaining small things together.

#/bin/sh
sort < /dev/stdin | uniq -c | sort -n
share|improve this answer
    
I would probably change this to -- sort $* | uniq -c | sort -n since then the script can take optional arguments. –  koblas Mar 14 '12 at 18:17

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.