grep: bug or feature ?

David N. Lombard dnlombar at ichips.intel.com
Thu Feb 19 15:10:35 UTC 2009


On Thu, Feb 19, 2009 at 07:45:04AM -0700, walter harms wrote:
> Hi list,
> i was porting a script to an embedded box with bb and found the
> following effect:
> 
> ./busybox grep "[a-Z]" /etc/hosts
> grep: bad regex '[a-Z]': Invalid range end
> 
> while
>  grep "[a-Z]" /etc/hosts
> 
> works with no problem.

This behavior is a locale issue in GNU grep, that is, '[a-Z]'
appears to be interpreted as '[A-Za-z]' in en_US while '[a-z]' is
used literally.

Under LC_ALL=C, '[a-Z]' is silently used, apparently as an empty set.  

-- 
David N. Lombard, Intel, Irvine, CA
I do not speak for Intel Corporation; all comments are strictly my own.


More information about the busybox mailing list