Bourne shell idioms Posted by lgv on Tuesday April 05, 2011 @09:56AM from the billharlan.com dept. http://billharlan.com/pub/papers/Bourne_shell_idioms.html ( 1 comment | 2 points | on HN )
Count the number of times a given line occurs with $ sort | uniq -c | sort -n
$ awk '{x[$0]++}END{for(y in x) print y, x[y]}' (helpful on billion-line files, so that you dont have to sort)