Date: Fri, 13 Mar 2009 00:13:08 +0000 From: Frank Shute <frank@shute.org.uk> To: David Banning <david+dated+1237311277.37b93e@skytracker.ca> Cc: questions@freebsd.org Subject: Re: sed error "unescaped newline inside substitute pattern" Message-ID: <20090313001308.GA94751@melon.esperance-linux.co.uk> In-Reply-To: <20090312173436.GA51898@skytracker.ca> References: <20090312173436.GA51898@skytracker.ca>
next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, Mar 12, 2009 at 01:34:36PM -0400, David Banning wrote: > > Here is the php line that gives the error; > > cat start_text | sed "s/--maintext--/$test/" > endtext > > give error; > > sed: 1: "s/--maintext--/ Comment ...": unescaped newline inside substitute pattern > > where $test contains customer input from a website form > > There is something about the content of the text within the variable $test that is causing the error. > > Any pointers would be helpful. I think your problem is that $ is an end of line as a regex. So sed is choking on the fact that there's some text ("test") after the end of line. I can't really tell you how to fix it, although backslash escaping the $ might be worth a try. Regards, -- Frank Contact info: http://www.shute.org.uk/misc/contact.html
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20090313001308.GA94751>