Description of Problem:
$ cat um
$ grep [:upper:] um
(and locale seems to be irrelevant here)
How Reproducible: always (yay!)
Steps to Reproduce:
1. create a file with lines of only lower-case letters, only upper-case
letters, only numerals
and combinations of each
2. grep [:upper:] filename
Actual Results: As pasted above
Expected Results: Only lines with an upper-case character in whatever locale
you're in returned.
I have known about this for a while now, but had always thought I was reading
the info grep
pages incorrectly. Asking around, I find that apparently I'm using the above
(and [:alpha:] and
so on) correctly after all. I have LC_COLLATE=C in my bash_profile. I set
LC_ALL to C just
in case and got the same results.
I am sure this was happening on at least 7.3 and possibly earlier. It's just
taken me that
long to find out that it wasn't just me being inept (unless you tell me the
contrary). It is
also happening on Debian and SuSE, in grep versions 2.4.2 and 2.5.1. I shall try
to find the
right place to report this upstream as well, but I was halfway through this
I found it was happening on other distros.
Alternatively, if I am using the patterns wrongly, then I reckon it's a bug in
the info page :)
It's a bug in the info page...
$ grep [[:upper:]] ../um
I honestly think this is very unclear documentation. I managed to
confuse a lot of people with this one.
"Finally, certain named classes of characters are predefined *within*
bracket expressions" (my emphasis); there's also an example.
grep [[:upper:]] um