A little script:
There's a lot of Unix idioms that I use often enough to have turned
into little shell scripts. Here's the first of them; I call it
#!/bin/sh trap '' 13 sort "$@" | uniq -c | sort -nr
trap is necessary because of a Linux bash issue.)
Howmany does what its name says: it counts up how many times each line of its standard input appears, then shows them from most to least frequent with the count. It usually gets used at the end of pipelines that crunch logs and the like.