I use:
diff <(xxd file1.bin) <(xxd file2.bin)
This uses process substitution to compare the output of two xxd
processes. Note that this still shows line differences, so if any byte on a line is different it will be listed. This gives a nice hexdump-looking comparison.
The classical tool for this however, is cmp
.
So, this could be handled like so:
cmp -l file1.raw file2.raw | grep -in "oldValue" | grep -in "newValue"
This will list exactly what you need, with the following fields printed out:
OFFSET VALUE_IN_FILE_1 VALUE_IN_FILE_2