I’m terribly annoyed by the fact that grep(1) cannot look for
binary strings. I’m even more annoyed by the fact that a simple
search for “binary grep” doesn’t yield a tool which could do that.
So I wrote one: bgrep.c.
– Felix “tmbinc” Domke in April, 2009
curl -L 'https://github.com/tmbinc/bgrep/raw/master/bgrep.c' | gcc -O2 -x c -o /usr/local/bin/bgrep -
Usage is simple: Just give it a hex string (without spaces) as first argument, and possibly use
?? to mask out bytes. It will print the file names corresponding offsets where the binary pattern matches.
Feel free to modify, branch, fork, improve. Re-licenses as BSD.
UPDATE: I’ve relocated bgrep.c to github. Feel free to send pull-requests!
Thanks for sharing the other day, @weef!