perl help, please
David
david at damnetwork.net
Mon Mar 17 18:55:31 MST 2008
I'm trying to write a perl script that will
- read a txt file with name=value pairs
- loop through a shell script (see attached .txt file)
- grab the contents of a particular function
- replace the name=value pairs from the function with the value from the
txt file
- grab the corresponding case statement from the shell script
- search and replace the values in the case statement
- write it all out to a new file in the correct order.
I need to be able to run this script on about 200 ksh scripts, mostly
with the same name=value pairs. However, there are many scripts with
different/extra name=value pairs.
ex:
It needs to take the abqenv () function, copy the whole thing to newenv
(), replace all the value of all the variables with the new value that
it gets from the txt file. Then put that new function *after* the
abqapps function.
next, it needs to grab each abqapps) sections (under the case statement)
and do the same thing.
Unfortunately, it's cutting off the "abqenv () {" and "}" lines from
the abqenv part. argh!
I have attached the perl script I have so far. Like I said, it mostly
works.
Please don't laugh too much at the ugliness of my perl. I'm no perl
monk by any stretch.
Any tips/help would be appreciated.
Thanks
David
--
"I find your lack of faith disturbing."
--Darth Vader
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: env-changes.txt
Url: http://lists.PLUG.phoenix.az.us/pipermail/plug-discuss/attachments/20080317/b00c1268/attachment.txt
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: new-vars.txt
Url: http://lists.PLUG.phoenix.az.us/pipermail/plug-discuss/attachments/20080317/b00c1268/attachment-0001.txt
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: wavegen_SB.txt
Url: http://lists.PLUG.phoenix.az.us/pipermail/plug-discuss/attachments/20080317/b00c1268/attachment-0002.txt
More information about the PLUG-discuss
mailing list