seek_m has asked for the wisdom of the Perl Monks concerning the following question:
hi monks,
i want to parse a text file in the following manner.
input:
sample.txt
12345.pace .......... ..text1.. ...... 12345.slow 123456.pace .......... ..text2.. ...... 123456.slow hyds.pace .......... ..bla bla bla.. uiw.slow
Expected output:
i want to copy the text between each .pace and .slow pattern if and only if the pattern preceeding ".pace" & ".slow" are numbers and put it in to a new file which will have the name preceeding the corresponding .pace as the file name.
for example if i parse the above input file i need to get an output of 2 files with filenames 12345 & 123456 respectively. with the word "text1" inside file 12345 and "text2" inside file 123456 .
kindly help me out?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: copying lines in a text file to a new file with a dynamically generated text name
by Ratazong (Monsignor) on Feb 14, 2011 at 06:53 UTC | |
by seek_m (Initiate) on Feb 16, 2011 at 09:49 UTC | |
|
Re: copying lines in a text file to a new file with a dynamically generated text name
by davido (Cardinal) on Feb 14, 2011 at 08:50 UTC | |
by seek_m (Initiate) on Feb 16, 2011 at 09:50 UTC | |
|
Re: copying lines in a text file to a new file with a dynamically generated text name
by 7stud (Deacon) on Feb 15, 2011 at 00:23 UTC | |
by Anonymous Monk on Feb 18, 2011 at 05:04 UTC | |
by seek_m (Initiate) on Feb 18, 2011 at 05:05 UTC |