in reply to Regex copy and paste help
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.
|
---|
In Section
Seekers of Perl Wisdom