sed command does not behave equal from 10.3 to 11.0
José García Juanino
jjuanino at gmail.com
Wed Jul 27 09:11:10 UTC 2016
On 27 July 2016 at 10:45, krad <kraduk at gmail.com> wrote:
> are you sure you aren't hitting a port or something?
>
> # uname -r ; echo "abc_ABC.def" | sed -e 's/[^A-Z0-9]//g' ; which sed ; md5
> /usr/bin/sed
> 10.3-STABLE
> ABC
> /usr/bin/sed
> MD5 (/usr/bin/sed) = 34e6aedf3b42cbd6dd8379342626e0db
In 10.3 I get the following:
$ freebsd-version -ku
$ which sed ; md5 /usr/bin/sed
/usr/bin/sed
MD5 (/usr/bin/sed) = 858696b78b6d8ed26a1e9835b1bcd89f
In 11.0-BETA2 I get:
$ freebsd-version -ku
$ which sed ; md5 /usr/bin/sed
/usr/bin/sed
MD5 (/usr/bin/sed) = 229d361061fcf528be12d513ad9a2cf3
I think that the issue is locale or encoding related, as it happens
also with gsed, but *not* with LANG=C:
$ locale
LANG=es_ES.ISO8859-15
LC_CTYPE="es_ES.ISO8859-15"
LC_COLLATE="es_ES.ISO8859-15"
LC_TIME="es_ES.ISO8859-15"
LC_NUMERIC="es_ES.ISO8859-15"
LC_MONETARY="es_ES.ISO8859-15"
LC_MESSAGES="es_ES.ISO8859-15"
LC_ALL=
$ echo "abc_ABC.def" | sed -e 's/[^A-Z0-9]//g'
bcABCdef ### wrong
$ export LANG=C
$ locale
LANG=C
LC_CTYPE="C"
LC_COLLATE="C"
LC_TIME="C"
LC_NUMERIC="C"
LC_MONETARY="C"
LC_MESSAGES="C"
LC_ALL=
$ echo "abc_ABC.def" | sed -e 's/[^A-Z0-9]//g'
ABC ## right
More information about the freebsd-stable
mailing list