TheBigAmbulance has asked for the wisdom of the Perl Monks concerning the following question:
I need to have the script search for 'LKTA' in the line. If it contains text, serialize the number portion starting at 1 and ending at 4. when it hits the fifth instance of 'LKTA', start back at 1 (loop until complete basically). If it doesn't contain the string 'LKTA', simply print the line.Name - John filename "LKTA_mic4.cfg"; } Name - Tim filename "LKTA_mic2.cfg"; } Name - Jane filename "LKTA_mic1.cfg"; } Name - Jim filename "LKTA_mic3.cfg"; } Name - Don filename "LKTA_mic1.cfg"; } Name - Cody filename "LKTA_mic4.cfg"; }
My knowledge of Perl is limited, and the scripts I have been trying to write are a dismal failure. I think the best method for this would be to delete the number, and then just run a serializing loop printing 1 through 4. Any help you have to offer would be very nice of you.Name - John filename "LKTA_mic1.cfg"; } Name - Tim filename "LKTA_mic2.cfg"; } Name - Jane filename "LKTA_mic3.cfg"; } Name - Jim filename "LKTA_mic4.cfg"; } Name - Don filename "LKTA_mic1.cfg"; } Name - Cody filename "LKTA_mic2.cfg"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: serialze text in a file
by toolic (Bishop) on Jul 07, 2009 at 17:04 UTC | |
by biohisham (Priest) on Jul 08, 2009 at 14:37 UTC | |
by toolic (Bishop) on Jul 08, 2009 at 16:04 UTC | |
|
Re: serialze text in a file
by BioLion (Curate) on Jul 07, 2009 at 17:20 UTC |