I have 2 files, they are different versions of the same thing. However, one has different hexadecimal values, memory addresses, than the other.
Is there a diff command or a filter I can use to diff with so that the output will only be lines that are different after ignoring different hex values?
# diff output I would like to filter:
- .. 0x000000010e428bb4 _swift_stdlib_bridgeErrorToNSError + 388",
- .. 0x000000010e3f0347 swift_dynamicCast + 2455",
- .. 0x000000010e3f051a swift_dynamicCast + 2922",
+ .. 0x00000001013f2bb4 _swift_stdlib_bridgeErrorToNSError + 388",
+ .. 0x00000001013ba347 swift_dynamicCast + 2455",
+ .. 0x00000001013ba51a swift_dynamicCast + 2922",
Just use sed
to rewrite the hex numbers. Something like:
sed 's/0x[0-9a-f]*/HEX/g'
Which given input like:
.. 0x000000010e428bb4 _swift_stdlib_bridgeErrorToNSError + 388",
Results in:
.. HEX _swift_stdlib_bridgeErrorToNSError + 388",
You could combine this with your diff
statement like (assuming bash
):
diff <(sed 's/0x[0-9a-f]*/HEX/g' file1) <(sed 's/0x[0-9a-f]*/HEX/g' file2)