[X-Unix] How does one find a string in a binary file, etc.?

Aaron aaron at macuser.fastmail.fm
Tue Sep 2 09:06:46 PDT 2008


Thanks, Björn, for your quick response.

>From: "B. Kuestner" <kuestner at macnews.de>
>Date: Tue, 2 Sep 2008 15:43:00 +0200
>
>Try "man strings".

That gets a negative result. "man string" turns up a bunch of C functions. "apropos string" turns up lots and lots of C functions and a few other useless items. Am I missing something?

>If that doesn't solve your problem, you might want to ask the group 
>again exactly which part you're missing, and we might find answers to 
>these follow-up questions.
>
>Regards,
>Björn

Regardless of whether I need them to solve my current problem or not, I would like to know how to do the following without programming in anything more complicated than a shell or awk or sed:

1) Search a binary file to see if it contains a certain string.

2) Read a file one (possibly arbitrary-length) block at a time and process that block before going on to the next, as one can easily do in a language like C.

But, I think I'll be able to solve the problem I'm working on in other ways. One way is by doing nested splits so as to wind up with 4-KB files without having enormous numbers of such files around at any one time. I would then use 'cmp -n' to compare each 4-KB file to a smaller file containing the common start of each of the files I'm looking for.

 - Aaron


More information about the X-Unix mailing list