[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: GNU grep 2.5.1
From: |
Hans-Bernhard Broeker |
Subject: |
Re: GNU grep 2.5.1 |
Date: |
1 Apr 2005 12:32:04 GMT |
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"
> grep -c "\xaa\x55\x00\x00\x04\x90" bigDataFile
> should be faster. Well, it is faster, but it always says 0.
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.
I'm not at all convinced that passing '\0' characters to grep via the
command line can ever possibly work. C programs do tend to react
badly to strings with string terminators anywhere else but at their
end.
Would be it be heresy to suggest you just write a little C program for
doing this, instead?
--
Hans-Bernhard Broeker (address@hidden)
Even if all the snow were burnt, ashes would remain.
- GNU grep 2.5.1, Marvin Hile, 2005/04/01
- Re: GNU grep 2.5.1,
Hans-Bernhard Broeker <=