Bug 122022

Summary: grep end-of line anchor with alpha range fails
Product: Red Hat Enterprise Linux 3 Reporter: Eric Klimas <eklimas>
Component: grepAssignee: Tim Waugh <twaugh>
Status: CLOSED NOTABUG QA Contact: Mike McLean <mikem>
Severity: medium Docs Contact:
Priority: medium    
Version: 3.0   
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2004-04-30 13:12:48 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Eric Klimas 2004-04-29 19:52:04 UTC
Description of problem:
grep doesn't seem to be case sensitive on a range pattern anchored to
the end of the line (i.e. '[A-Z]$' or '[a-z]]$').

Version-Release number of selected component (if applicable):
grep-2.5.1-16


How reproducible: Always


Steps to Reproduce:
1. Create a file (t.txt) that has the following in lines in it:
This is
a
Test of GREP
to seE
if its
working
12345
Another linE


2. run the command:
grep '[A-Z]$' t.txt

3. run the command:
grep '[ABCDEFGHIJKLMNOPQRSTUVWXYZ]$' t.txt

4. run the command:
grep '[A-P]$' t.txt 

5. run the commnad:
grep '[ABCDEFGHIJKLMNOP]$' t.txt

Actual results:
[rds@rdsone ietmcm]$ grep '[A-Z]$' t.txt                  
This is
Test of GREP
to seE
if its
working
Another linE
[rds@rdsone ietmcm]$ grep '[ABCDEFGHIJKLMNOPQRSTUVWXYZ]$' t.txt
Test of GREP
to seE
Another linE
[rds@rdsone ietmcm]$ grep '[A-P]$' t.txt
Test of GREP
to seE
working
Another linE
[rds@rdsone ietmcm]$ grep '[ABCDEFGHIJKLMNOP]$' t.txt
Test of GREP
to seE
Another linE


Expected results:
[rds@rdsone ietmcm]$ grep '[A-Z]$' t.txt                  
Test of GREP
to seE
Another linE
[rds@rdsone ietmcm]$ grep '[ABCDEFGHIJKLMNOPQRSTUVWXYZ]$' t.txt
Test of GREP
to seE
Another linE
[rds@rdsone ietmcm]$ grep '[A-P]$' t.txt
Test of GREP
to seE
Another linE
[rds@rdsone ietmcm]$ grep '[ABCDEFGHIJKLMNOP]$' t.txt
Test of GREP
to seE
Another linE


Additional info: none

Comment 1 Tim Waugh 2004-04-30 13:12:48 UTC
[A-Z] is not generally a case-sensitive range, and neither is [a-z] --
except for the specific case of the C locale.

Perhaps you mean to use '[[:upper:]]' and '[[:lower:]]'?