bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: echo a | grep "[A-Z]"


From: Hans-Bernhard Broeker
Subject: Re: echo a | grep "[A-Z]"
Date: 3 Dec 2001 18:21:52 GMT

Erling Kopperdal <address@hidden> wrote:
> Thanks for a great product!  I found the following in the GNU grep:

> The line:
> echo a | grep "[A-Z]"
> produces:
> a

I know this must look like a bug, but it's not one.  It's a required
feature. 

The reason for this peculiar behaviour is right in your environment
output:

> LC_COLLATE=no

That, and the (IMHO rather boneheaded) requirement in some Unix
standards that grep should use the locale's collation sequence to
implement character ranges, instead of what they used to for ages on
end: rely on ASCII order.

For many locales, obviously including "no", the collation sequence has
case-ignoring order, i.e. 'a' is sorted like 'A', and thus before 'B'.

For your own mental sanity, it'll be better to reset LC_COLLATE to "C"
unless you're sure you really want this particular behaviour.

-- 
Hans-Bernhard Broeker (address@hidden)
Even if all the snow were burnt, ashes would remain.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]