Today I learned how to find all repeating lines in a text file. My goal was to find out all lines in a text which repeat more than once. A dirty, but efficient way is using sort(8) and uniq(8) combination (thanks to my boss for a pointer).
$ sort /var/log/messages | uniq -d
Do not try to pass a file directly to uniq(8) unless it is sorted. Uniq(8) can find only adjacent equal lines. If you think lines are randomly dispersed throughout the file, uniq will not return correct result. Be careful.