From owner-freebsd-questions@FreeBSD.ORG Thu Jun 28 10:36:26 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 D02EA16A421 for ; Thu, 28 Jun 2007 10:36:26 +0000 (UTC) (envelope-from infofarmer@gmail.com) Received: from nz-out-0506.google.com (nz-out-0506.google.com [64.233.162.237]) by mx1.freebsd.org (Postfix) with ESMTP id 8F6E813C4BD for ; Thu, 28 Jun 2007 10:36:26 +0000 (UTC) (envelope-from infofarmer@gmail.com) Received: by nz-out-0506.google.com with SMTP id l8so7693nzf for ; Thu, 28 Jun 2007 03:36:25 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:sender:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references:x-google-sender-auth; b=VuYuVvvvE9fH+8EfX88j12XbFgAnLKfyHWv55EWWAnFb1axfNL49UDEcinrGjdyAxZDe6w7ktHfoN3MiDFvaSuTL+AY/X9UibmMoRaW6OW5vn/1MQUhbNnZj8jeH3NNgD6txKZORiykrUn/POer0D7KpmbkcVGVh9bhdB5F7FuQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:sender:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references:x-google-sender-auth; b=gRp7sm/UnR6tvjS7mbDU/viUuGl6EFkO3T4DQS+Q8ci6F6uy7gw3Bg1D5K0H1SQxv/WNenE578vfbgo4gNj9oDzvHVRXpvrAzr87tGrdyx6mN6EfOba1EYoqft/Sxvmb/maM+YTJGx9PT6UX6ZxB8XrLeR0ejAa2MfGE5tGtyLs= Received: by 10.114.94.1 with SMTP id r1mr1439770wab.1183026985483; Thu, 28 Jun 2007 03:36:25 -0700 (PDT) Received: by 10.114.194.5 with HTTP; Thu, 28 Jun 2007 03:36:25 -0700 (PDT) Message-ID: Date: Thu, 28 Jun 2007 14:36:25 +0400 From: "Andrew Pantyukhin" Sender: infofarmer@gmail.com To: "Olivier Regnier" In-Reply-To: <46838E41.4060902@oregnier.net> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <46838E41.4060902@oregnier.net> X-Google-Sender-Auth: cd428fd9f0954bca 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:36:26 -0000 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.