.
If I had to do this quickly and dirty, I would probably do something like diff -U 1,000,000 (assuming the version of diff that supports it) passed through sed to just get the common lines (and strip leading spaces). However, you will have to iterate over all the files.
Edit: I forgot that there is a Tcl implementation that would be a little more universal, but would require more coding. You can find an implementation for your language of choice.
source
share