vim - diff - find specific change between two values in hex dump -
i analyzing hex data binary data dumps basic command-line program of mine. i'm dumping exact contents of struct (a large array of structs, actually) text file.
i create second binary dump, , compare 2 files in vim
using xxd
create binary-to-text representations of original data.
both files exact same size in bytes, , i'm trying compare 2 in meaningful way. small change in data before dump file results in large change in other parts of file, due other sections containing hashes, functions based on value changed, , forth.
is possible tell diff
or vimdiff
say, compare 2 files, , show me parts of file in original file (ie: file 1) value set 1
, , in second file, value set 32
?
thank you!
i use:
diff <(xxd file1.bin) <(xxd file2.bin)
this uses process substitution compare output of 2 xxd
processes. note still shows line differences, if byte on line different listed. gives nice hexdump-looking comparison.
the classical tool however, cmp
.
so, handled so:
cmp -l file1.raw file2.raw | grep -in "oldvalue" | grep -in "newvalue"
this list need, following fields printed out:
offset value_in_file_1 value_in_file_2
Comments
Post a Comment