Re: SED collation sequence

Petr Pisar <[email protected]>
Newsgroups gmane.comp.gnu.utils.bugs
Message-ID <[email protected]>
On 2014-08-06, william moss <[email protected]> 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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.