Date: Thu, 28 Jun 2007 14:36:25 +0400 From: "Andrew Pantyukhin" <infofarmer@FreeBSD.org> To: "Olivier Regnier" <oregnier@oregnier.net> Cc: freebsd-questions@freebsd.org Subject: Re: Problem with sed to insert a new line Message-ID: <cb5206420706280336v204c8caava4c6259a5397fbf6@mail.gmail.com> In-Reply-To: <46838E41.4060902@oregnier.net> References: <46838E41.4060902@oregnier.net>
next in thread | previous in thread | raw e-mail | index | archive | help
On 6/28/07, Olivier Regnier <oregnier@oregnier.net> wrote: > Hi everyone, > > I have a file called "test" with the following lines: > ### > a > b > > d > e > f > ### > > With sed, i want to insert the "c" letter after "b" letter. Logically > simple, but not for me. > > Here is my command : # sed -i.old -e "4i\c" > > I have this message : sed: 1: "4i\c": extra characters after \ at the > end of i command AFAIK, with our sed you can only do that with multiline command: % sed -i.old -e "4i\\<press enter> c" test The backslash is doubled, because shells interpret backslash-newline as a space. With GNU sed it's much easier.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?cb5206420706280336v204c8caava4c6259a5397fbf6>