7
3
I have a binary file like this (open in Emacs hex mode): How can I grep if hex values '22081b00081f091d2733170d123f3114' exists in the file?
00000000: 2b08 1b00 1418 0825 0407 3830 271d 170d +......%..80'...
00000010: 2208 1b00 081f 091d 2733 170d 123f 3114 ".......'3...?1.
00000020: 1909 1b00 0934 1f10 2503 3803 111c 3821 .....4..%.8...8!
In my example, it should return a hit since the hex values I am looking for is in address 0x10.
See Binary grep on Linux?
– Scott – 2014-10-29T21:34:02.447What happens if you
grep
for it?grep 2208 1b00 081f 091d 2733 170d 123f 3114
, with the spaces. – terdon – 2013-08-04T17:57:24.043grep
knows theP
option, so you can usegrep -aP '\x22\x08\x1b...'
. The answer is from http://stackoverflow.com/questions/6319878/using-grep-to-search-for-hex-strings-in-a-file - I guess you're only interested in the retcode, so you should redirect the output to/dev/null
. – ott-- – 2013-08-04T18:45:38.280Use a hex editor. "Hex Editor Neo" is a good free one for Windows. I'd guess there are some for *nix as well. – Daniel R Hicks – 2013-08-04T19:34:45.403