[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
possible grep bug: -i switch with character class
From: |
Chris Jerdonek |
Subject: |
possible grep bug: -i switch with character class |
Date: |
Mon, 2 Nov 2009 20:37:18 -0800 |
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 will also attempt to report this here:
http://savannah.gnu.org/projects/grep/
Thanks,
--Chris
test.txt
Description: Text document
- possible grep bug: -i switch with character class,
Chris Jerdonek <=