2

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?

1 Answer 1

5

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.

1
  • The -l option to cmp seems very much like what I want, wonder why I didn't check the man page. Commented Aug 26, 2018 at 9:54

You must log in to answer this question.

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