Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 26 Jun 2004 12:08:24 -0500
From:      "antenneX" <antennex@swbell.net>
To:        <freebsd-questions@freebsd.org>
Subject:   A SED script
Message-ID:  <00ce01c45ba0$343ffc00$0200000a@SAGEAME>

next in thread | raw e-mail | index | archive | help
Running FBSD-4.10

Below is a portion of a script that uses sed(1) to change a portion of a
line in a file. It works fone for that one.

However, 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

....and, again the line in the file:
$OrderNumPrefix = "ATX060"; <---line in the file to change

What do I need to change to make it work....???

Thanks for any help!




Best regards,

Jack L. Stone



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?00ce01c45ba0$343ffc00$0200000a>