Hello,

>> echo '1303141571.M26770P15859.m01S=1884W=1934:2S' | egrep '[A-Z]$' --color
> --> red colored S at the end
> 
>> echo '1303141571.M26770P15859.m01S=1884W=1934:2S' | egrep '[a-z]$' --color
> --> grep matches the string but there is no color
> 
> can you explain that too?

Quoting from the 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."


Nevertheless, with recent versions of grep you should obtain a result
which is consistent with what you expect ([a-z] doesn't match uppercase
letters anymore with en_US.UTF8).

Nicolas



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to