Date: Sat, 07 Apr 2007 13:34:28 -0700 From: Garrett Cooper <youshi10@u.washington.edu> To: freebsd-questions@freebsd.org Subject: Re: script perl with sed command Message-ID: <46180054.6050002@u.washington.edu> In-Reply-To: <4617B954.7010507@steelbox.org> References: <4617B954.7010507@steelbox.org>
next in thread | previous in thread | raw e-mail | index | archive | help
Olivier Regnier wrote:
> Hello,
>
> I have a problem with my perl script with the command sed. Here is a
> example of my code:
>
> # Selecting the fast server
> print "Using the server called $server";
> system(`/usr/bin/sed 's|\*default host=\(.*\)|\*default
> host=${server}|' $standard_supfile > $standard_supfile.copy`);
> system('/bin/mv $standard_supfile.copy $standard_supfile');
>
> But in console i have this message:
> sed: 1: "s|*default host=(.*)|*d ...": unescaped newline inside
> subsitute pattern
>
> Can you help me please ?
>
> Thank you :)
You forgot "chomp $server;" All commands with backticks ('`') have
newlines inserted after them.
There should only be one reference to "*default host=" though, so
why are you going through the trouble of using sed?
This can be done inline with perl as well.
-Garrett
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?46180054.6050002>
