$ sort names.txt | uniq          # unique names, sorted
$ sort names.txt | uniq -c       # also show how many times each appeared
