I need to extract the data that is under the column headers. I have
attached a sample of the printed report. The real report repeats the same
format over and over again until completion.
I would like to extract the data and place it in an excel spreadsheet.
Based on the sample data, it looks like the following things can be keys you use:
1) you don't have any data that needs to be extracted (if I understood you correctly) until after you hit a line starting with '=', followed by a blank line.
2) each group of data is separated by a blank line, but contains no blank lines.
3) the first line after a blank line is the column headers. However to figure out where the columns are, you need the line after that, which has '-'s to indicate the length of the column.
So, at least to get the data from the section between the lines of '='s, I would do something like this:
when I hit a blank line, start a new report.
the line immediately following a blank line has header info, save it, get the next line. locate all of the spaces in the line, use that to parse the header line into fields. save this spacing information, so that I can also parse the following lines.
from then on, for each line, if it is a blank line, go back to the start. If the line contains a row of 6 (say) or more '-', skip it. Otherwise split it based on the spacing info that is current.
HTH, Ricky
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>
