[OpenIndiana-discuss] OI and GNU grep

Alan Coopersmith alan.coopersmith at oracle.com
Tue Oct 11 16:50:39 UTC 2011


On 10/11/11 09:42 AM, Richard Jones wrote:
> I'm probably being really thick, but what's going on here?
>
>     set | grep -i grep
>     $ which grep
>     /usr/gnu/bin/grep
>     $ echo foo | grep '[A-Z]'
>     foo
>
> I get the expected behaviour on linux boxes with GNU grep.

Run "locale" to see what locale you are running in:

$ echo foo | env LANG='C' /usr/gnu/bin/grep '[A-Z]'
$ echo foo | env LANG='en_US.UTF-8' /usr/gnu/bin/grep '[A-Z]'
foo

The Solaris UTF-8 locales use case insensitive ordering, so [A-Z]
expands to A, a, B, b, C, c, ... Y, y, Z.

The C locale uses ASCII value ordering, so [A-Z] expands to
A, B, C, ... Y, Z.

-- 
	-Alan Coopersmith-        alan.coopersmith at oracle.com
	 Oracle Solaris Platform Engineering: X Window System




More information about the OpenIndiana-discuss mailing list