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

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

grep


From: Holger Lehmann
Subject: grep
Date: Tue, 25 Jun 2002 17:01:10 +0200

Hi !

I think I found a severe bug in grep. I (think I) am an advanced grep user :-)
I have been using grep and other standard gnu tools on my linux distribution 
since linux-0.99pl14 ....

I was working on old data. There is an example included in test.txt.
This old data sometimes contains an "empty" row with a "backspace" (\b or ^H 
resp. 0xa0)  at the beginning of the line.
I wanted to skip these lines.
My initial attempt was to grep for those lines and check the outcome:

$ grep '^\b' < test.txt > backspace.txt

But to my surprise it contained the lines without backspaces ....
I inverted my selection:

$ grep -v '^\b' < test.txt > no-backspace.txt

which should have not included any lines containing backspaces, when you 
believe in the manual page (which I read about 5 times by then). But to my 
minor surprise it containd all lines *with* backspaces at the beginning.
So I though my installation migth be buggy in quickly ran the two 
cross-checks:

$ grep '^7' < test.txt > sevens.txt

and:

$ grep -v '^7' < test.txt > no-sevens.txt

to see wether my brain was damaged, my man-page was faulty or my grep was 
broken. It surprised me even less to see the outcome *now* was completely 
compliant to the manual page.

As far as I understand it, the first two grep statements work completely 
opposite to the last two grep statements but they should not, should they ?
I have included the text files for your convinience.
The Gnu Grep tells me this on

$ grep --version
grep (GNU grep) 2.4
....

The LANG variable is set as follows:

$ echo $LANG
address@hidden

and LC_COLLOCATE is

$ echo $LC_COLLATE
POSIX

The grep rpm is the SuSE 7.2 standard rpm grep-2.4-29

I would apprecieate any kind of feedback.

Thanks in advance, Holger

-- 
-----------------------------------------------------------------
Building Bridges
-o-o-o-o---------------------------------------------------------

catWorkX GmbH
Dipl.-Ing. Holger Lehmann
Stresemannstrasse 364
22761 Hamburg
Tel: +49 (700) catWorkX
Tel: +49 (40)  89 06 46-0
Fax: +49 (40)  89 06 46-66
mailto:address@hidden
http://www.catworkx.de
http://www.catbridge.de

Attachment: backspace.txt
Description: Text document

Attachment: no-backspace.txt
Description: Text document

Attachment: no-sevens.txt
Description: Text document

Attachment: sevens.txt
Description: Text document

Attachment: test.txt
Description: Text document


reply via email to

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