insert new line in files
Adam Vande More
amvandemore at gmail.com
Fri Feb 6 15:49:37 PST 2009
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.
nevermind I see I have to \\ that as well. Okay now I'm going to try to
find a way to do this with find and xargs
More information about the freebsd-questions
mailing list