Date: Sun, 6 Jul 2008 16:57:49 -0400 From: "Glen Barber" <glen.j.barber@gmail.com> To: freebsd-questions@freebsd.org Subject: Re: Sed in FreeBSD Message-ID: <4ad871310807061357nf1c6bb1oeba05b02f7883ba1@mail.gmail.com> In-Reply-To: <486F8BB8.6040704@mammothcheese.ca> References: <692660060807050706i6e02fe04t840bc0a2aff1e8ae@mail.gmail.com> <486F8BB8.6040704@mammothcheese.ca>
next in thread | previous in thread | raw e-mail | index | archive | help
On 7/5/08, James Bailie <jimmy@mammothcheese.ca> wrote: > Sebastian Tymk=F3w wrote: > > > > I've tried with sed -e '/PATTERN/ a\ line' file but this did'n work. Th= ere > > are many axamples in internet but none > > of them work on FreeBSD. > > > > The inserted line needs to be on a separate physical line. > > sed -e '/PATTERN/a\ > line' > > For /bin/csh, you need two backslashes because the shell recognizes > backslashes inside single-quotes, which it shouldn't. > IIRC, you also need the '-i' flag, even if you do not specify a backup extension: sed -i '' -e 's/foo/bar/' myfile http://www.dev-urandom.com/unix/sed Regards, --=20 Glen Barber http://www.dev-urandom.com/
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4ad871310807061357nf1c6bb1oeba05b02f7883ba1>