Re: GUN Sed Bug

Eric Blake <[email protected]>
Newsgroups gmane.comp.gnu.utils.bugs
Organization Red Hat
Message-ID <[email protected]>
On 10/26/2012 06:42 AM, 王森 wrote:

> [root@localhost learn_sed]# /bin/sed "s/\'/ End/" tmp.txt
> hello world End
> I'am in china End
> [root@localhost learn_sed]#
> ### My Question
> I want to know the reason.  \' be equal to Line End ?

Thanks for the report.  However, this is not a bug, but a GNU extension,
as documented here:
https://www.gnu.org/software/sed/manual/html_node/Escapes.html#Escapes

In your particular case, end of line and end of input happen to match.
But if your sed script had also used commands like 'N', then you could
see a difference where multi-line mode makes \' match fewer places than $.

-- 
Eric Blake   [email protected]    +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc (application/pgp-signature, 617 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)
Comment: Public key at http://people.redhat.com/eblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://www.enigmail.net/

iQEcBAEBCAAGBQJQivtYAAoJEKeha0olJ0Nq8+MIAIX80urFVxlRnafTp+igS/6V
7jOeZRmm7jFddu2Jg5S+Iy+XOJ8HkK32XvwKPgoCzVKThAEdgpZ0a12RWKpOrfC7
aeEn8KdrsWi3UnHAU3fWBGeLkG7wk5xTcmX6HiL5EE5TTpKzpEtXpunYhNkjPlBp
4PpQW5RcfUrKY52TCiSQshdjb1i9z3l2IuugAX1XDDyODM57+T9Fhinkrtn+KClV
z+2klM7EOv55DSJIK8PMCG19Cjm46uiqZb3DHmKHeWZwoVoIucsef0UGsAFH4Hvf
WaO33dz05FYVooEBDA7fGsovhkpIfGb4MOinlxc1VLWBK4jaUAAP1e+OV/UMV1I=
=6Lz3
-----END PGP SIGNATURE-----
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.