----- Original Message ----- 
From: "Giorgos Keramidas" <[EMAIL PROTECTED]>
To: "antenneX" <[EMAIL PROTECTED]>
Sent: Saturday, June 26, 2004 1:40 PM
Subject: Re: A SED script

> On 2004-06-26 12:08, antenneX <[EMAIL PROTECTED]> wrote:
> > I cannot get it to work on another file (perl.pl file) to change the
> > $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
> 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.

Indeed, this works fine. The old/new files are needed to set the
varibles to hold the new number for the next time as this is run via

old = ATX060
new = ATX070

....then, after the script changes the line in the perl script, it needs
to pipe (echo/cat) in the new file contents to the old:
cat newfile > oldfile ---> which is now ATX070 for oldfile
...then incremement the newfile to become "ATX080" and so on....

Now, got to figure out how to increment number up. It is an invoice
prefix number that contains the month # and must modify the perl file
that is part of a custom order set of scripts.....

[EMAIL PROTECTED] mailing list
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to