[GTALUG] Processing a binary file with a shell script

Giles Orr gilesorr at gmail.com
Mon Aug 10 14:31:38 UTC 2015


On 10 August 2015 at 04:12, Ansar Mohammed <ansarm at gmail.com> wrote:
> Hello All,
> I am writing a bourne shell script, to read a binary file as input and take
> action depending on the contents of the file.
>
> The file is a mixture of ASCII and binary codes (such as ASCII filed lengths
> and flags).
>
> I have the processing already done in C. I would like to convert it to a
> bourne shell.
>
> Does anyone have any suggestions on what combination of tools I may be able
> to use?

If you're only trying to look at the ASCII data (and trying to process
binary data in Bash seems like a poor idea), then you may want to look
at the "strings" command:

$ strings $(which ls)

"strings" is part of the binutils package on Debian.

-- 
Giles
http://www.gilesorr.com/
gilesorr at gmail.com


More information about the talk mailing list