Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
up vote 3 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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .