hi all! The freebsd versions of sed contained a bug/regression, when \n char can i subsitue, gsed not affected with this bug: FreeBSD xxx 8.1-RELEASE FreeBSD 8.1-RELEASE #0: Mon Jul 19 02:55:53 UTC 2010 root@almeida.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC i386 aa@xxx ~> echo axa | sed s/x/\n/g ana aa@xxx ~> echo axa | sed s/x/'\n'/g ana it is FreeBSD 8.1 base systems sed aa@centaur:~$ uname -a Linux centaur 2.6.18-6-686 #1 SMP Thu Aug 20 21:56:59 UTC 2009 i686 GNU/Linux aa@centaur:~$ echo axa | sed s/x/\n/g ana aa@centaur:~$ echo axa | sed s/x/'\n'/g a a aa@centaur:~$ sed --version GNU sed verzi?? 4.1.5 ural2:~$ uname -a SunOS ural2 5.8 Generic_117350-62 sun4u sparc ural2:~$ echo axa | sed s/x/\n/g ana ural2:~$ echo axa | sed s/x/'\n'/g a a ural2:~$ sed --version GNU sed version 4.2.1
On Wed, Jan 12, 2011 at 02:32:52AM +0100, Oliver Pinter wrote:> hi all! > > The freebsd versions of sed contained a bug/regression, when \n char > can i subsitue, gsed not affected with this bug:> FreeBSD xxx 8.1-RELEASE FreeBSD 8.1-RELEASE #0: Mon Jul 19 02:55:53 > UTC 2010 root@almeida.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC > i386 > aa@xxx ~> echo axa | sed s/x/\n/g > ana > aa@xxx ~> echo axa | sed s/x/'\n'/g > anaDifferent than GNU is not a bug. I have 7.3 here. It behaves as the above, which is how the man page says it should work. The following is how the man page specifies you can substitute a newline, by prefacing a quoted actual newline with a backslash: $ echo axa | sed 's/x/\> /g'a a That's how I remember classic sed behaving (Unix v7 or thereabouts.) -- Clifton -- Clifton Royston -- cliftonr@iandicomputing.com / cliftonr@lava.net President - I and I Computing * http://www.iandicomputing.com/ Custom programming, network design, systems and network consulting services
On 2011-Jan-12 02:32:52 +0100, Oliver Pinter <oliver.pntr@gmail.com> wrote:>The freebsd versions of sed contained a bug/regression, when \n char >can i subsitue, gsed not affected with this bug:gsed contains non-standard extensions and you have been suckered into using them. Try using 'gsed --posix' and/or setting POSIXLY_CORRECT. This is part of the GNU/FSF "lockin" policy that encourages people to use their non-standard extensions to ensure that you don't have any choice other than to use their software. -- Peter Jeremy -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 196 bytes Desc: not available Url : http://lists.freebsd.org/pipermail/freebsd-stable/attachments/20110112/7f2f558f/attachment.pgp