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: Claudio Fontana
Subject: Re: GNU grep 2.5.1
Date: Fri, 1 Apr 2005 22:56:41 +0200 (CEST)

Hello,

the correct place to speak about supposed grep bugs is
now address@hidden .

By the way, I think that Marvin is trying to avoid
using od and going directly for the bytes when he
says:

> I have been doing
> 
> od -x bigDataFile | grep -c "aa55 0000 0490"
> 
> which gives me the answer 560912 when a file has not
> been
> corrupted. This is fine but quite slow.
> 
> Today I decided that
> 
> grep -c "\xaa\x55\x00\x00\x04\x90" bigDataFile
> 
> should be faster.

The main problem is that the \xnn syntax is not a
posix regex, but a perl regex.

There is another (byte ordering) problem in the fact
that od -x shows bytes in pairs, interpreting them as
short integers.

I think the original poster would solve his problem
by:

1) using 

$ od -t x1 BigDataFile

to extract the correct byte by byte sequence he wants
to use as validation

2) replacing 

grep -c "\xNN\xNN\xNN"

with

grep -P -c '\xNN\xNN\xNN'

This being said, there are lots of better solutions to
the 'validation' problem that do not involve grep.

Hope this helps.

Claudio





                
___________________________________ 
Nuovo Yahoo! Messenger: E' molto più divertente: Audibles, Avatar, Webcam, 
Giochi, Rubrica… Scaricalo ora! 
http://it.messenger.yahoo.it




reply via email to

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