From owner-freebsd-questions@FreeBSD.ORG Thu Jun 28 10:52:49 2007 Return-Path: X-Original-To: freebsd-questions@freebsd.org Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id B6A8816A468 for ; Thu, 28 Jun 2007 10:52:49 +0000 (UTC) (envelope-from oregnier@oregnier.net) Received: from 30.mail-out.ovh.net (30.mail-out.ovh.net [213.186.62.213]) by mx1.freebsd.org (Postfix) with SMTP id 18B1D13C4AE for ; Thu, 28 Jun 2007 10:52:48 +0000 (UTC) (envelope-from oregnier@oregnier.net) Received: (qmail 5879 invoked by uid 503); 28 Jun 2007 10:53:09 -0000 Received: (QMFILT: 1.0); 28 Jun 2007 10:53:09 -0000 Received: from b7.ovh.net (HELO mail25.ha.ovh.net) (213.186.33.57) by 30.mail-out.ovh.net with SMTP; 28 Jun 2007 10:53:09 -0000 Received: from b0.ovh.net (HELO queue-out) (213.186.33.50) by b0.ovh.net with SMTP; 28 Jun 2007 10:52:44 -0000 Received: from mac76-2-82-241-6-173.fbx.proxad.net (HELO ?127.0.0.1?) (postmaster@oregnier.net@82.241.6.173) by ns0.ovh.net with SMTP; 28 Jun 2007 10:52:43 -0000 Message-ID: <4683938E.30708@oregnier.net> Date: Thu, 28 Jun 2007 12:55:10 +0200 From: Olivier Regnier User-Agent: Thunderbird 2.0.0.4 (Windows/20070604) MIME-Version: 1.0 To: Andrew Pantyukhin References: <46838E41.4060902@oregnier.net> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Ovh-Remote: 82.241.6.173 (mac76-2-82-241-6-173.fbx.proxad.net) X-Ovh-Local: 213.186.33.20 (ns0.ovh.net) X-Spam-Check: DONE|H 0.5/N Cc: freebsd-questions@freebsd.org Subject: Re: Problem with sed to insert a new line X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Jun 2007 10:52:49 -0000 Andrew Pantyukhin a écrit : > On 6/28/07, Olivier Regnier 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\\ > c" test > > The backslash is doubled, because shells interpret > backslash-newline as a space. With GNU sed it's > much easier. > _______________________________________________ > freebsd-questions@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-questions > To unsubscribe, send any mail to > "freebsd-questions-unsubscribe@freebsd.org" Hello, Ok with your command : % sed -i.old -e "4i\\ c" test It's good but if i want to use my command in a shell script ? It's possible or not :) Thank you :) Olivier.