bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: SED collation sequence


From: Petr Pisar
Subject: Re: SED collation sequence
Date: Thu, 7 Aug 2014 06:37:04 +0000 (UTC)
User-agent: slrn/1.0.1 (Linux)

On 2014-08-06, william moss <address@hidden> wrote:
> On Debian
> uname -a
> Linux bbunny 3.2.0-4-686-pae #1 SMP Debian 3.2.60-1+deb7u3 i686 GNU/Linux

This has nothing to do with kernel. libc, sed versions, and your locale
matter.

> sed(1) collation sequence \x00-\x1f would not work, \x01-\x1f works
> fine.
Maybe sed has some weired implmentation I don't know, however in general
character ranges are subject of collation which is defined by locale
(LC_COLLATE and maybe LC_CTYPE). If your locale sorts \x00 after \x1f,
then the the range will be empty. Try set them to "C" locale.

> command used is
> A=$( 'the result of a call to an application'
>       |& sed -r -e's/\x00-\x1f\x80-\xff/?/g' )
>
Does that really work? Shouldn't the expression be:

s/[\x00-\x1f\x80-\xff]/?/g

If you will not find a solution with sed, try perl which supports
special character class `ascii' like this:

$ echo ažb | perl -pe 's/[[:^ascii:]]/?/g'
a??b

-- Petr




reply via email to

[Prev in Thread] Current Thread [Next in Thread]