Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 11 Jan 2011 21:00:09 -1000
From:      Clifton Royston <cliftonr@lava.net>
To:        Oliver Pinter <oliver.pntr@gmail.com>
Cc:        stable@freebsd.org
Subject:   Re: sed is broken under freebsd?
Message-ID:  <20110112070009.GB20924@lava.net>
In-Reply-To: <AANLkTin=Jeah8UX7QB-Uk1x9VYBtnFw=nX8fptLJW%2Bs4@mail.gmail.com>
References:  <AANLkTin=Jeah8UX7QB-Uk1x9VYBtnFw=nX8fptLJW%2Bs4@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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
> ana

Different 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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20110112070009.GB20924>