I have three sets of repeating blocks of data. Each one has a start word and an end word. I'm showing these and the sizes below:
Block 1
Start: Experiment
End : Reagent Lot
Size : 10 lines followed by one blank line
Block 2
Start : Algorithm Parameters
End : FCMax
Size : 5 lines followed by one blank line
Block 3
Start : Experiment
End : Pixels
Size : 8 lines followed by one blank line
So what happens is for four sets of data, there will be four sets of block 1, followed by four sets of block 2, followed by 4 sets of block 3. Followed by more stuff I was going to try and figure out before bothering you kind monks again :).
I had already thought out a short cut - all blocks are the same size, so I simply needed to know how many experiments there were, say 4, and then count down through each of the blocks as I already know the order and size of each. So some simple addition and division could get me where I needed to be.
What I was pretty clueless about was how to match the first block and somehow write it to an output file, repeat for all the Block 1s, then do the same for all the Block 2, etc. I do want to learn how to do multiple line extractions of text - it is a good general technique and I can use it for other stuff - Thank you!
Now I'll go play with your suggestions...
MadraghRua
yet another biologist hacking perl....
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.