Red Hat Bugzilla – Bug 590002
grep changed behavior for interval patterns
Last modified: 2010-06-17 05:17:30 EDT
Description of problem:
$ echo $LANG
$ echo -e "HELLO\nworld" | grep '[a-z]'
$ LC_COLLATE=C echo -e "HELLO\nworld" | grep '[a-z]'
Character intervals are dependent on collates (LC_COLLATE). Default - locale UTF based collate - is excellent for sorts but not so friendly to interval searches: aAbBcC...yYzZ.
Old grep behaviour was wrong, on the other hand new POSIX based behaviour can bring troubles - break old scripts. More customers and also internal tools could be affected.
Document in RHEL6 release notes
1. to preserve old behavior: export LC_COLLATE=C
2. correct way to grep lower/upper case is to use patterns [:lower:],[:upper:]..
Version-Release number of selected component (if applicable):
This request was evaluated by Red Hat Product Management for inclusion in a Red
Hat Enterprise Linux major release. Product Management has requested further
review of this request by Red Hat Engineering, for potential inclusion in a Red
Hat Enterprise Linux Major release. This request is not yet committed for
There's no code change needed, all we need is proper documentation. The bug for Migration guide is bug #594571 .
Development Management has reviewed and declined this request. You may appeal
this decision by reopening this request.