This is a classic data conversion problem. I have done similar things many times over the years with both parallel and serial printer ports and a variety of different operating systems. The other answer focused on actual formatting of the data, which is a real issue. I will discuss the actual transfer process:
- The two machines have to agree on communication protocol. With serial ports (this is RS-232C and similar, not USB), the key parameters are speed, parity and handshaking. Speed and parity are easy - typically 9600 bps or 19200 bps for a DOS printer, and very easy to configure in DOS (not so easy in some older systems...) and Linux. Parity will almost always be None for DOS printers, though other settings are possible. Handshaking is the tricky part - set it as best as you can and then deal with the problems (more below).
- Cabling for standard serial is easy. At least, it is with the right tools. The minimum is transmit, receive and ground, but you will need more if you use hardware handshaking. When the connection is between two similar machines (e.g., any two PC-type systems with standard 9-pin ports) then a null modem cable will (mostly...) do the trick. But a breakout box like this one:
can help figure out pretty much any combination of port pin configurations. For a one-off/temporary situation, I might wire up a breakout box and leave it in place. For a permanent installation, a custom cable (if a standard cable won't do) is a good idea to avoid problems when someone knocks out a jumper wire.
On the receiving side you will need some sort of program to capture the data. This might be a real "communication program" or it may be some command to capture everything coming in from a port to a file until told to stop.
The big problem is often handshaking. Even super-fast computers can end up with funny problems with a 9600 bps data stream if the handshaking doesn't work properly. Sometimes adjusting the handshaking parameters helps, sometimes playing around with the cable configuration helps, and sometimes nothing seems to work. When nothing seems to work right, for example if I can see hardware handshaking happen on a breakout box but a character or two gets lost in each batch due to overflow (slow reaction by the source machine to the request to stop, combined with minimal/no OS port buffer space on the destination machine), then I either try a slower speed, add a buffer box or increase the software (application level) buffer.
If the receiving computer doesn't have a traditional serial port, you can either add a USB Serial port or a PCI card. Generally speaking, I would trust a PCI (or a motherboard serial port) more than USB when it comes to handling handshaking properly.
"Printing" thousands of bakery account records or medical billing history files can take a while. I typically do some short tests to make sure I have the handshaking and capture process working and then let it run overnight (or however long it takes).