From owner-freebsd-questions@FreeBSD.ORG Sat Apr 7 20:34:42 2007 Return-Path: X-Original-To: freebsd-questions@freebsd.org Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 04F6A16A409 for ; Sat, 7 Apr 2007 20:34:42 +0000 (UTC) (envelope-from youshi10@u.washington.edu) Received: from mxout3.cac.washington.edu (mxout3.cac.washington.edu [140.142.32.166]) by mx1.freebsd.org (Postfix) with ESMTP id D73E313C487 for ; Sat, 7 Apr 2007 20:34:41 +0000 (UTC) (envelope-from youshi10@u.washington.edu) Received: from smtp.washington.edu (smtp.washington.edu [140.142.32.139]) by mxout3.cac.washington.edu (8.13.7+UW06.06/8.13.7+UW07.03) with ESMTP id l37KYf05001490 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Sat, 7 Apr 2007 13:34:41 -0700 X-Auth-Received: from [192.168.10.45] (c-24-7-142-221.hsd1.ca.comcast.net [24.7.142.221]) (authenticated authid=youshi10) by smtp.washington.edu (8.13.7+UW06.06/8.13.7+UW07.03) with ESMTP id l37KYeuw001831 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT) for ; Sat, 7 Apr 2007 13:34:40 -0700 Message-ID: <46180054.6050002@u.washington.edu> Date: Sat, 07 Apr 2007 13:34:28 -0700 From: Garrett Cooper User-Agent: Thunderbird 1.5.0.10 (Windows/20070221) MIME-Version: 1.0 To: freebsd-questions@freebsd.org References: <4617B954.7010507@steelbox.org> In-Reply-To: <4617B954.7010507@steelbox.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-PMX-Version: 5.3.0.289146, Antispam-Engine: 2.5.0.283055, Antispam-Data: 2007.4.7.132434 X-Uwash-Spam: Gauge=IIIIIII, Probability=7%, Report='__CT 0, __CTE 0, __CT_TEXT_PLAIN 0, __HAS_MSGID 0, __MIME_TEXT_ONLY 0, __MIME_VERSION 0, __SANE_MSGID 0, __USER_AGENT 0' Subject: Re: script perl with sed command 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: Sat, 07 Apr 2007 20:34:42 -0000 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