in reply to pulling fields out of a ascii print file

I don't have anything particularly helpful, but I would handle it with a regex-on-every-line solution.

Making the unproven assumption that the blocks of data are consistent, i.e. that they start with a name, the next line is a number only, and they end with two lines both beginning with the word "total", you can have your program read each line and do different kinds of data-grabbing based on context-- $current_company = 'Slate'; $reading_names = true until you get to the word Total at which time $reading_names goes back to false and so on.

I'd like to hear other Monks' thoughts on this though. It's prone to error and you have to be very sure of the data to do it with any confidence.
--

“Every bit of code is either naturally related to the problem at hand, or else it's an accidental side effect of the fact that you happened to solve the problem using a digital computer.”
M-J D
  • Comment on Re: pulling fields out of a ascii print file