Converting a fixed-width report to an Excel-friendly formatby loris (Hermit)
|on Oct 25, 2006 at 15:11 UTC||Need Help??|
loris has asked for the
wisdom of the Perl Monks concerning the following question:
I have been given what seems to me a slightly hairy task. I have a report with fixed-width fields similar to this:
Note the spurious ^L characters, which appear as boxes in my browser, at the beginning of some lines and the over-wide fields running into the following line.
This needs to be converted to Excel-readable format, e.g. CSV, containing the information from the table-like parts with information from the line after the headers in additional colums, like this:
I would approach this in the following way
Does any one have any less naive ideas? I wondered whether there is there something like format for reading files?
"It took Loris ten minutes to eat a satsuma . . . twenty minutes to get from one end of his branch to the other . . . and an hour to scratch his bottom. But Slow Loris didn't care. He had a secret . . ."