Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: Parsing multiple rows of text and converting to columns

by hdb (Parson)
on Jun 25, 2013 at 06:23 UTC ( #1040541=note: print w/ replies, xml ) Need Help??


in reply to Parsing multiple rows of text and converting to columns

If you set $/="" then the <FILE> construct will read in paragraphs, ie blocks of lines separated by empty lines.

Within these paragraphs, you can extract your data with a regular expression. For example, /Findings\|(\d+)\|(.*)>\n(.*)/ would extract the record number, the item description and the value as $1, $2 and $3. You could store them in a hash like this $hash{$1}{$2} = $3 for further processing, sorting and printing.


Comment on Re: Parsing multiple rows of text and converting to columns
Select or Download Code
Re^2: Parsing multiple rows of text and converting to columns
by gingeremmie (Initiate) on Jun 25, 2013 at 09:47 UTC
    Thank you everybody, much appreciated, I will go and do some experimenting with the ideas you have given me
    Not sure why I was told to post my code in code tags because I didn't post any code? My code is non existent at the moment hehe! I just posted the raw data I was trying to extract. Should that have been in code tags? I wouldn't have thought so but I'm new to this, so would be grateful if someone could let me know.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1040541]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (9)
As of 2014-08-29 23:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (289 votes), past polls