According to grep man page:
...
Within a bracket expression, a range expression consists of two
characters separated by a hyphen. It matches any single character that sorts
between the two characters, inclusive, using the localeâs collating
sequence and character set. For example, in the default C locale, [a-d] is
equivalent to [abcd]. Many locales sort characters in dictionary order, and
in these locales [a-d] is typically not equivalent to [abcd]; it might be
equivalent to [aBbCcDd], for example. To obtain the traditional
interpretation of bracket expressions, you can use the C locale by setting
the LC_ALL environment variable to the value C.
...
> I reproduced the problem. My default locale is en_US.UTF-8.
>
> When I use:
>
> LC_ALL=en_US.iso-8859-8 egrep -n '[A-Z]'
>
> the lowercase letters are not matched.
>
> It is still mysterious to me why egrep (or grep) folds lowercase into
> uppercase when the locale is UTF-8.
>
> David Harel wrote:
> > In the commands below I insert data to grep via standard input and
> > terminate with <Ctrl-D>. Lines that match the expression are echoed
> > back. To improve visibility I used -n option so we can see the line
> > number of the matched line. BUT.
> > Can anyone explain the following behavior?
> > Did anyone fiddle with the weight of letters?
> >
> > Right
> > ==========================================================
> > [EMAIL PROTECTED] tmp]$ grep -n '[ABCDEFGHIJKLMNOPQRSTUVWXYZ]'
> > 123
> > abc
> > ABC
> > 3:ABC
> >
> >
> > Wrong
> > ====================================
> > [EMAIL PROTECTED] tmp]$ grep -n '[A-Z]'
> > 123
> > ABC
> > 2:ABC
> > abc
> > 3:abc
>
> --- Omer
> My own blog is at http://www.livejournal.com/users/tddpirate/
>
> My opinions, as expressed in this E-mail message, are mine alone.
> They do not represent the official policy of any organization with which
> I may be affiliated in any way.
> WARNING TO SPAMMERS: at http://www.zak.co.il/spamwarning.html
>
>
> =================================================================
> To unsubscribe, send mail to [EMAIL PROTECTED] with
> the word "unsubscribe" in the message body, e.g., run the command
> echo unsubscribe | mail [EMAIL PROTECTED]
================================================================To unsubscribe, send
mail to [EMAIL PROTECTED] with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail [EMAIL PROTECTED]