From owner-freebsd-questions@FreeBSD.ORG Sat Jun 26 19:52:33 2004 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 1E4F916A4CE for ; Sat, 26 Jun 2004 19:52:33 +0000 (GMT) Received: from frodo.otenet.gr (frodo.otenet.gr [195.170.0.12]) by mx1.FreeBSD.org (Postfix) with ESMTP id 5C5B543D46 for ; Sat, 26 Jun 2004 19:52:32 +0000 (GMT) (envelope-from keramida@ceid.upatras.gr) Received: from gothmog.gr (patr530-b201.otenet.gr [212.205.244.209]) by frodo.otenet.gr (8.12.10/8.12.10) with ESMTP id i5QJpoIw002325 for ; Sat, 26 Jun 2004 22:51:52 +0300 Received: from gothmog.gr (gothmog [127.0.0.1]) by gothmog.gr (8.12.11/8.12.11) with ESMTP id i5QJpj1f015759 for ; Sat, 26 Jun 2004 22:51:48 +0300 (EEST) (envelope-from keramida@ceid.upatras.gr) Received: (from giorgos@localhost) by gothmog.gr (8.12.11/8.12.11/Submit) id i5QIe8Vl017571; Sat, 26 Jun 2004 21:40:08 +0300 (EEST) (envelope-from keramida@ceid.upatras.gr) Date: Sat, 26 Jun 2004 21:40:08 +0300 From: Giorgos Keramidas To: antenneX Message-ID: <20040626184008.GB1016@gothmog.gr> References: <00ce01c45ba0$343ffc00$0200000a@SAGEAME> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <00ce01c45ba0$343ffc00$0200000a@SAGEAME> cc: freebsd-questions@freebsd.org Subject: Re: A SED script X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 26 Jun 2004 19:52:33 -0000 On 2004-06-26 12:08, antenneX wrote: > I cannot get it to work on another file (perl.pl file) to change the line: > $OrderNumPrefix = "ATX060"; to $OrderNumPrefix = "ATX070"; > > I suspect I'm not handling the quotes or other operators correctly and it > just ignores the change. > > Here's the snippet of the script I'm trying to use: > #!/bin/sh > new=`grep -i new /path/to/newfile` > old=`grep -i new /path/to/oldfile` > sed -i.bak -e "s/$old/$new/" /path/to/myfile The results depend heavily on the existence and contents of the two files named /path/to/{old,new}file. I'm sure if you change the sed line to: sed -i.bak -e 's/ATX060/ATX070/' /path/to/myfile it will all work fine. > What do I need to change to make it work....??? Something within oldfile or newfile, is a far reaching guess. - Giorgos