Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 06 Feb 2009 18:55:57 -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:  <498CCE0D.6010208@ibctech.ca>
In-Reply-To: <498CCBA9.6010207@gmail.com>
References:  <498CBEBE.7080702@gmail.com>	<20090206225619.GA75180@dan.emsphone.com>	<498CC0FC.1040706@gmail.com>	<20090206232129.GB75180@dan.emsphone.com> <498CCBA9.6010207@gmail.com>

Next in thread | Previous in thread | Raw E-Mail | Index | Archive | Help
Adam Vande More wrote:
> Dan Nelson wrote:
>>> I had actually tried that too:
>>>
>>>  > sed -e '5i\
>>> ? test' text.txt
>>> sed: 1: "5i
>>> test
>>> ": command i expects \ followed by text
>>>     
>>
>> I don't see a backslash in the error message, which means something
>> ate it. Are you running this command from something other than the
>> commandline or a
>> plain sh script?  If you're calling this from another scripting language
>> (via system() or popen() or something similar), you probably have to
>> double
>> the backslash so whatever's parsing it out passes one through to sed.
>>   
> This is being executed from stock tcsh
> 
> Progress is being made as it works in the test now with the \\ however
> I'm running into more things I don't understand in regards to what I
> need to escape in my input string.
> 
>> sed -e '5i\\
> include(\'/usr/home/www/imp-sites/default_inventory.php\');' test.txt
> Unmatched '.
> 
> I also tried escaping ( ) . / to no avail.

I don't know for sure under tcsh, but did you try double quotes as I
suggested? Using them may prevent the normally special characters from
being interpolated.

If it doesn't work, then hopefully escaping them will.

Steve



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