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?
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.