The problem is that Solaris sed is always broken in innovative new ways and 
doesn't understand character classes.

It seems that in Norwegian, "aa" is matched like a special character (one 
of the weird a's, I guess) and therefore is not in the [a-z] range:

$ export LC_COLLATE=nn_NO.utf8
$ echo aa | sed 's/[^a-z]/*/g' 
*

$ export LC_COLLATE=C
$ echo aa | sed 's/[^a-z]/*/g' 
aa



On Thursday, February 6, 2014 1:37:18 PM UTC, Vegard Lima wrote:
>
> On Thu, Feb 6, 2014 at 2:22 PM, Vegard Lima <vegar...@gmail.com<javascript:>> 
> wrote: 
> > On Thu, Feb 6, 2014 at 2:07 PM, Volker Braun 
> > <vbrau...@gmail.com<javascript:>> 
> wrote: 
> >> This works for me on Fedora 20. Something must be wrong with your sed. 
> What 
> >> do you get for 
> ... 
> >> $ echo 5b5e732cd1eaa01bcfa2b47903ce6ea041a0fae3 | sed 's/[^0-9a-f].*//' 
> >> 5b5e732cd1eaa01bcfa2b47903ce6ea041a0fae3 
> > 
> > Same sed version. Found the culprit: 
> > 
> > $ echo $LC_COLLATE 
> > nn_NO.utf8 
> > $ echo 5b5e732cd1eaa01bcfa2b47903ce6ea041a0fae3 | sed 's/[^0-9a-f].*//' 
> > 5b5e732cd1e 
>
> This behaviour is apparently known: 
> http://teaching.idallen.com/net2003/06w/notes/character_sets.txt 
>
> A safe alternative that should work independently of LC_COLLATE is this: 
>
> $ echo 5b5e732cd1eaa01bcfa2b47903ce6ea041a0fae3 | sed 
> 's/[^[:xdigit:]].*//' 
>
> (see http://www.regular-expressions.info/posixbrackets.html) 
>
>
> Thanks, 
> -- 
> Vegard 
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to