Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: Regex copy and paste help

by roboticus (Canon)
on Aug 31, 2012 at 10:56 UTC ( #990982=note: print w/ replies, xml ) Need Help??


in reply to Regex copy and paste help

HtorneDK:

I'd suggest something like this:

Keep two sets of fields: the temporary set and the full set you're building.

  • Read a line and parse it into the temporary fields (unpack, substr)
  • If the first column exists (e.g. A00004) then it looks like you're on a new item, so:
    • If you have anything in the "full" set:
      • process it
      • write the processed data
    • Copy the temporary data into your "full" set
  • Otherwise
    • Append the existing temporary fields into your full set
  • then go back and process the next line

Finally, when you're done, if you have anything in your full set, process it.

...roboticus

When your only tool is a hammer, all problems look like your thumb.


Comment on Re: Regex copy and paste help

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (16)
As of 2014-10-20 12:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (76 votes), past polls