Legacy data parsing

Jorgen Grahn jgrahn-nntq at algonet.se
Fri Jul 8 20:01:30 EDT 2005


On Fri, 8 Jul 2005 15:03:45 -0500, Thomas Bartkus <thomasbartkus at comcast.net> wrote:
> "gov" <Gov at mailinator.com> wrote in message
> news:1120847474.604271.196220 at g49g2000cwa.googlegroups.com...
>> Hi,
>>
>> I've just started to learn programming and was told this was a good
>> place to ask questions :)
>>
>> Where I work, we receive large quantities of data which is currently
>> all printed on large, obsolete, dot matrix printers.  This is a problem
>> because the replacement parts will not be available for much longer.
>>
>> So I'm trying to create a program which will capture the fixed width
>> text file data and convert as well as sort the data (there are several
>> different report types) into a different format which would allow it to
>> be printed normally, or viewed on a computer.
>
> Text file data has no concept of "fixed width".  Somewhere in your system,
> text file data is being thrown at your dot matrix printer.  It would seem a
> trivial exercise to simply plug in a newer and probably inexpensive
> replacement printer.
>
>   What am I missing here?

I was just wondering the same thing.

Until/unless we don't get an answer: here's two hypotheses:

- The text file is too wide for modern-day laser printers to print properly,
  or the printer isn't configured to accept plain text (accented characters,
  line feeds and so on).
  -> feed it through 'enscript' or a similar utility, which can 
     scale it down and manipulate it in various ways into a Postscript
     file, and print that one
- The text file isn't really a text file, but full of escape codes for
  the matrix printer (boldfacing and so on).
  -> attempt to clean it with a utility like the standard unix 'col' command
  -> ... and/or write custom code to do it. Python is a good choice.

In general, this is an area where it's wise to use existing software.
The hard part is to know what's available!

/Jorgen

-- 
  // Jorgen Grahn <jgrahn@       Ph'nglui mglw'nafh Cthulhu
\X/                algonet.se>   R'lyeh wgah'nagl fhtagn!



More information about the Python-list mailing list