Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 06 Feb 2009 18:17:40 -0500
From:      Steve Bertrand <steve@ibctech.ca>
To:        Adam Vande More <amvandemore@gmail.com>
Cc:        Dan Nelson <dnelson@allantgroup.com>, freebsd-questions@freebsd.org
Subject:   Re: insert new line in files
Message-ID:  <498CC514.1000905@ibctech.ca>
In-Reply-To: <498CC0FC.1040706@gmail.com>
References:  <498CBEBE.7080702@gmail.com>	<20090206225619.GA75180@dan.emsphone.com> <498CC0FC.1040706@gmail.com>

Next in thread | Previous in thread | Raw E-Mail | Index | Archive | Help
Adam Vande More wrote:
> Dan Nelson wrote:

>> You want:
>>
>> sed -e '5i\
>> test' test.txt
>>
>> i.e. a linebreak after the backslash.
>>
>>   
> I had actually tried that too:
> 
>> sed -e '5i\
> ? test' text.txt
> sed: 1: "5i
> test
> ": command i expects \ followed by text

Try:

# sed -e "5i\\
? test" text.txt

Note the double-quotes and two \\.

I just ran into this today ;)

Steve



Want to link to this message? Use this URL: <http://docs.FreeBSD.org/cgi/mid.cgi?498CC514.1000905>