Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Is there a standard Linux tool that looks for similarities between two files? The diff tool works best comparing files that are mostly the same, and outputs where they differ. I'm looking for a tool to compare files that are mostly different, and output their similarities.

share|improve this question
    
Some good answers at SO –  RedGrittyBrick Aug 8 '12 at 16:08

2 Answers 2

up vote 2 down vote accepted

comm -12 file1 file2 will print the lines that exist in both files; I think it only works for sorted files, though.

share|improve this answer
    
The files won't be sorted, but I think this is going to be my best option. –  Andrew Wood Aug 8 '12 at 17:26

You mught try using vimdiff or gvimdiff. However, they too find differences raather than similarities. I doubt an application for what you suggested exists.

share|improve this answer
    
Yeah, I use vimdiff a lot. These files are too different for that to be useful though. –  Andrew Wood Aug 8 '12 at 14:43

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.