grep problem?
Jim Garrison
Jim.Garrison@troux.com
Mon Apr 4 22:46:00 GMT 2011
I'm getting weird behavior from grep. Searching for a bracketed range of characters (i.e. [A-Z]) is doing case-insensitive matching, while an identical but explicit character set match (i.e. [ABCDE...Z]) does not. Examples below. Output of "cygcheck -s -v -r" attached.
LANG=en_US
GREP_OPTIONS is unset
$ cat > test.dat
abcde
ABCDE
$ grep '[A-Z]' test.dat
abcde
ABCDE
$ grep '[A-E]' test.dat
abcde
ABCDE
$ grep '[a-z]' test.dat
abcde
ABCDE
$ grep '[a-e]' test.dat
abcde
ABCDE
$ grep '[a-b]' test.dat
abcde
ABCDE
Contrast with the correctly-working examples below
$ grep '[ab]' test.dat
abcde
$ grep 'A' test.dat
ABCDE
$ grep a test.dat
abcde
$ grep '[A]' test.dat
ABCDE
$ grep '[ABC]' test.dat
ABCDE
$ grep '[ABCDE]' test.dat
ABCDE
$ grep '[ABCDEFGHIJKLMNOPQRSTUVWXYZ]' test.dat
ABCDE
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cygcheck.out
Type: application/octet-stream
Size: 39660 bytes
Desc: cygcheck.out
URL: <http://cygwin.com/pipermail/cygwin/attachments/20110404/92505d4c/attachment.obj>
-------------- next part --------------
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
More information about the Cygwin
mailing list