in reply to quick and safe way to deal with this?
Are you talking about the unix/gnu diff tool? How did you use it, and in what sense did it not work? Given two files, if they are different, diff will report what the differences are, and will return an exit status of 1 if the files differ, or 0 (="success") if they are identical.
If you don't want to see all the lines that differ, you can use the "cmp" command instead; it gives the same exit status as diff does, but will otherwise be fairly quiet, and will will only read all of its two input files when they happen to be identical (i.e. it stops as soon as it sees a difference). Examples:
But as someone else pointed out, if you have lots of files and you need to compare all possible pairings of files, you'll be better off computing md5 checksums for them (try the "md5sum" command or roll your own in perl with Digest::MD5), then sort by checksum string and look for duplicate checksums.cmp file1 file2 && echo same cmp file1 file2 || echo different
(Identical checksums is not a guarantee of identical content, different checksums definitely indicate different content. You only need to run cmp on pairs that have the same checksum, to confirm whether they are really identical.)
|
|---|