URL:
<http://savannah.gnu.org/bugs/?27919>
Summary: possible glitch with -i and character class
Project: grep
Submitted by: None
Submitted on: Tue 03 Nov 2009 04:45:17 AM UTC
Category: None
Severity: 3 - Normal
Item Group: None
Status: None
Privacy: Public
Assigned to: None
Open/Closed: Open
Discussion Lock: Any
_______________________________________________________
Details:
There seems to be some sort of glitch with character classes and the -i
(--ignore-case) switch.
I am using Mac OS X 10.6.1 (Snow Leopard).
grep --version shows v2.5.1.
I have not checked the latest grep version. Hopefully you can do that
without too much trouble.
To reproduce--
Create a text file called "test.txt" that consists of a single line of text
with the two letters T and K followed by a unix line feed, as shown below
(also see the attached file):
TK
(I did not attempt to reduce the test case further or see if the particular
choice of letters matters.)
The case-insensitive search "grep -i [A-Z]K test.txt" finds no matches while
the same search done case-sensitively (i.e. without the -i switch) does find a
match. See below for a console session that shows a couple other related
searches that work.
$ grep [A-Z]K test.txt
TK
$ grep [T]K test.txt
TK
$ grep -i [T]K test.txt
TK
$ grep -i [^A-Z]K test.txt
TK
$ grep -i [A-Z]K test.txt
$
I have also e-mailed this information to the bug-gnu-utils address.
Thanks,
--Chris
_______________________________________________________
File Attachments:
-------------------------------------------------------
Date: Tue 03 Nov 2009 04:45:17 AM UTC Name: test.txt Size: 3B By: None
Test case (one line file with letters T and K)
<http://savannah.gnu.org/bugs/download.php?file_id=18981>
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?27919>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/