Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: Regex copy and paste help

by roboticus (Chancellor)
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 wandering the Monastery: (5)
As of 2015-08-01 02:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (285 votes), past polls