bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: GNU grep 2.5.1


From: Bob Proulx
Subject: Re: GNU grep 2.5.1
Date: Fri, 1 Apr 2005 10:53:57 -0700
User-agent: Mutt/1.5.8i

Hans-Bernhard Broeker wrote:
> Marvin Hile <address@hidden> wrote:
> > I have quite a number of ~1 gigabyte data files on my system.
> > They have a certain internal structure, and each section starts
> > with a known pattern. This is so my software can "parse" them
> > quickly. To check to make sure they are not corrupted, I have
> > been doing
> 
> > od -x bigDataFile | grep -c "aa55 0000 0490"

Is this header always in the early part of the file?  If so then you
should be able to speed up the operation by using 'head' or 'sed' to
only pass the first part of it to grep and then stop.

> That may very well be because you forgot about endianness.  Let me
> venture a guess:
> 
>       od -tx1 bigDataFile | grep -c "aa 55 00 00 04 90"
> 
> will report 0 but
> 
>       od -tx1 bigDataFile | grep -c "55 aa 00 00 90 04"
> 
> will report the large number you expect.

A good observation.  Leading me to suggest these:

  od -x bigDataFile | head | grep -c "aa55 0000 0490"

  od -tx1 bigDataFile | sed 2000q | grep -c "55 aa 00 00 90 04"

Bob




reply via email to

[Prev in Thread] Current Thread [Next in Thread]