From owner-freebsd-questions@FreeBSD.ORG Fri Feb 6 23:49:37 2009 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3BDFB106564A for ; Fri, 6 Feb 2009 23:49:37 +0000 (UTC) (envelope-from amvandemore@gmail.com) Received: from imedmobility.com (host-50.216-16-29.iw.net [216.16.29.50]) by mx1.freebsd.org (Postfix) with ESMTP id 145028FC19 for ; Fri, 6 Feb 2009 23:49:36 +0000 (UTC) (envelope-from amvandemore@gmail.com) Received: from midco.net (host-47-73-107-208.midco.net [208.107.73.47]) by imedmobility.com (Postfix) with ESMTP id 638C81173C6B; Fri, 6 Feb 2009 17:49:36 -0600 (CST) Message-ID: <498CCC94.6080507@gmail.com> Date: Fri, 06 Feb 2009 23:49:40 +0000 From: Adam Vande More User-Agent: Thunderbird 2.0.0.18 (X11/20081225) MIME-Version: 1.0 To: Dan Nelson References: <498CBEBE.7080702@gmail.com> <20090206225619.GA75180@dan.emsphone.com> <498CC0FC.1040706@gmail.com> <20090206232129.GB75180@dan.emsphone.com> <498CCBA9.6010207@gmail.com> In-Reply-To: <498CCBA9.6010207@gmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: freebsd-questions@freebsd.org Subject: Re: insert new line in files 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: Fri, 06 Feb 2009 23:49:37 -0000 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