Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

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.


Comment on Re: Parsing multiple rows of text and converting to columns
Select or Download Code
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?
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 exploiting the Monastery: (15)
As of 2015-08-04 12:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The oldest computer book still on my shelves (or on my digital media) is ...













    Results (64 votes), past polls