sort file.txt | uniq -d > duplicates.txt