3 ms·
I'm confused, grep has bianary options. grep -U
by jpeg_hero 9y ago
I'm confused, grep has bianary options.
grep -U
- mysterypie 9y agoThe only thing the -U does is to not strip carriage returns embedded in the file. But if you do, for example, grep NSA_KEY suspiciousfile.exe, you're either going to get: (a) "Binary file suspiciousfile.exe matches" (which is what I get on the particular system I tried it on, and I'd call that semi-useful because I'd like to see some context around it) or possibly, (b) a 50,000-character gibberish output to your shell containing somewhere within it the string "NSA_KEY" if you can possibly scroll through it to see where it appeared. I think strings, or this bingrep, or some other binary-aware strings-like tool is better.
- an27 9y agoUnless you use -o/--only-matching, that works fine for binaries!