
Mailing List Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [tlug] binary search of binary data
>>>>> "Edward" == Edward Wright <edw@example.com> writes:
Edward> I use grep -ab for searching thru the file for text
Edward> strings, but I couldn't see how to pass a binary search
Edward> pattern to grep. Am I missing something simple here?
That's not a grep problem, that's a shell problem!<0.9wink>
I can think of a number of ways to deal with this. First, almost all
shells/terminal drivers allow entry of binary characters in some way,
for example use ^V<control character> for the low range and ALT-###
for the high range. Some shells will interpret octal escapes for you,
although I believe bash doesn't. Recent GNU greps support a
--perl-regexp (-P) option; I don't know if that implies processing
Perl string escapes, it may not. There's always the -f option to take
the search pattern from a file.
Finally, you can use 'grep -e `printf ...`'.
Unix rules, even when it sucks!
None of these are particularly satisfactory, which is why I suggested
doing the whole thing in <scripted-language-with-initial-character-p-
or-r-at-your-option>. (You could even use awk, etc.)
--
Institute of Policy and Planning Sciences http://turnbull.sk.tsukuba.ac.jp
University of Tsukuba Tennodai 1-1-1 Tsukuba 305-8573 JAPAN
Ask not how you can "do" free software business;
ask what your business can "do for" free software.
Home |
Main Index |
Thread Index