Hello Perl Monks,
I am relatively inexperienced in the ways of Perl, and I have a task that I need help with.
I have a file that contains data in columns headed with:
"Score" "Points" "Time" "Points" "Record" "Size" "Points" "Age" "Points" "Difficulty" "Size" "Points" "Name" (in that order)
Each column is populated with integer values, except for "Name".
I need to write a script that can search for the values of the first "Points" column after "Time" and the first "Points" column after "Difficulty" for rows containing 'intrepid' and 'triumph' in the Name column (may not be the full name). There could be hundreds of entries the file I'm searching, but only one will have a name containing triumph/victory. If it's any help, the "names" containing 'triumph' and 'intrepid' will always come directly before a row with 'Total' in the "Name" field.
As the end result, I want an output file that looks like:
team_triumph (this was the value in the "Name" column)
Time: 58 Difficulty: 23 (Values from first "Points" columns after "Time" and "Difficulty")
team_intrepid
Time: 6 Difficulty: 344
I'm not very experienced with Perl, so I'm not even sure how hard of a job this is. Could anyone give me a hand? I'd appreciate it greatly.
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.