[GTALUG] Processing a binary file with a shell script

Mauro Souza thoriumbr at gmail.com
Mon Aug 10 15:18:27 UTC 2015


If you have the program in C to process data, going to bash is like
swapping a large truck for a turtle. Bash will be orders of magnitude
slower, and you will have to take a lot of care to pipe data all over awk,
sed, tr and the like.
Bash is a terrible choice, python (or perl, or PHP) would be faster. Way
faster.

Mauro
http://mauro.limeiratem.com - registered Linux User: 294521
Scripture is both history, and a love letter from God.

2015-08-10 11:42 GMT-03:00 Brent Kimberley <Brent.Kimberley at durham.ca>:

> How about ihex or srec?
>
>
>   Original Message
> From: Giles Orr
> Sent: Monday, August 10, 2015 10:32
> To: GTALUG Talk
> Reply To: GTALUG Talk
> Subject: Re: [GTALUG] Processing a binary file with a shell script
>
>
> 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
> ---
> Talk Mailing List
> talk at gtalug.org
> http://gtalug.org/mailman/listinfo/talk
> THIS MESSAGE IS FOR THE USE OF THE INTENDED RECIPIENT(S) ONLY AND MAY
> CONTAIN INFORMATION THAT IS PRIVILEGED, PROPRIETARY, CONFIDENTIAL, AND/OR
> EXEMPT FROM DISCLOSURE UNDER ANY RELEVANT PRIVACY LEGISLATION. No rights to
> any privilege have been waived. If you are not the intended recipient, you
> are hereby notified that any review, retransmission, dissemination,
> distribution, copying, conversion to hard copy, taking of action in
> reliance on or other use of this communication is strictly prohibited. If
> you are not the intended recipient and have received this message in error,
> please notify me by return e-mail and delete or destroy all copies of this
> message.
> ---
> Talk Mailing List
> talk at gtalug.org
> http://gtalug.org/mailman/listinfo/talk
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://gtalug.org/pipermail/talk/attachments/20150810/bd805dfd/attachment.html>


More information about the talk mailing list