I have some media files (right now it's video files, but I suspect I would also be able to use a good solution on picture files), that are very similar, but according to diff
/cmp
not identical. But if it's only a few bytes that differ I might not be able to tell the difference (I know that depends lot on several things, let's ignore that). Does a program exist (preferably in Debian Stretch) that can output (an estimate of) how many bits/bytes in two files differ?
Add a comment
|
1 Answer
The cmp
program (unless you suppress its output with the -s
option) lists the differing bytes. You could get a count by piping that into wc
, e.g.,
cmp -l foo bar | wc -l
The -l
option tells it to list all differences. To account for different lengths, you'd have to make a more complicated script, since cmp
doesn't report that part.
-
The
-l
option tocmp
seems very much like what I want, wonder why I didn't check the man page. Commented Aug 26, 2018 at 9:54