David wrote: > 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 > > > ------------------------------------------------------------------------ > > --------------------------------------------------- > PLUG-discuss mailing list - PLUG-discuss@lists.plug.phoenix.az.us > To subscribe, unsubscribe, or to change your mail settings: > http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss I think your issue is with lines 106 & 107 in the perl script. You're calling 'next' when you encounter the "abqenv () {" line - BEFORE you're adding that line to the @newfile array. I didn't debug the entire thing, but it also looks like you're doing the same thing with the "}" (line 109 in the perl script). Hopefully this helps. Bart --------------------------------------------------- PLUG-discuss mailing list - PLUG-discuss@lists.plug.phoenix.az.us To subscribe, unsubscribe, or to change your mail settings: http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss