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

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

grep possible bug with option -i


From: Clifford Ekholm
Subject: grep possible bug with option -i
Date: Tue, 2 Oct 2001 00:12:26 +0300 (EEST)

  Hello guys

I am reading a book named "Mastering Regular Expressions" and tried an
example in the book to find doubled doubled words in a text; the example
is on page 20 in the seventh printing of the first edition.

The file I tested with is attached in this mail. Last 3 lines in the file
shows the commands I tried.

In the file "Bug_i_egrep.txt" I have (among other lines) the following 3
lines:

1: ... hupa hupa ...
2: ... Hupa Hupa ...
3: ... Hupa hupa ... 

And I expected the folowing command to print all three lines:

   egrep -i '\<([a-z]+) +\1\>' Bug_i_egrep.txt

However, the above command only caught the firs line.
Changing to 

   egrep -i '(\<[a-zA-Z]+) +\1\>'  Bug_i_egrep.txt

caught lines 1 and 2.

The third command I tried

   egrep -i huPa Bug_i_egrep.txt

caught all three lines.

In the man-pages it says about the "-i" option:

       -i, --ignore-case
              Ignore case distinctions in both the PATTERN and the input files.



Well, guess its up to you guys to decide if this is a bug or not.


Have yourself a nice day.

Clifford


/**********************  address@hidden  **************************************
Clifford Ekholm                <- WWW:   http://noon.abo.fi/~cliffa/
Abo Akademi University         <- WWW:   http://www.abo.fi/
Dept. of Chemical Engineering   * 
Laboratory for Inorganic Chem. <- WWW:   http://www.abo.fi/fak/ktf/ook/
Biskopsgatan 8                  * Voice: (+358)-2-2154822 Noon - Post Midnight
FIN-20 500 Abo                  * Fax:           -2154962
FINLAND                         * 
******************************************************************************/

Attachment: Bug_i_egrep.txt
Description: My test file


reply via email to

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