Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number

Re: Parsing multiple rows of text and converting to columns

by hdb (Prior)
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.

Replies are listed 'Best First'.
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?

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

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (16)
As of 2016-10-25 20:05 GMT
Find Nodes?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?

    Results (329 votes). Check out past polls.