netcat prints blank pages

Please direct me to the right forum tree if i am in the wrong section for this.

i have netcat on a unix machine and there is no man nc or man netcat available.

my command i am using is:
cat $FILE1 | netcat -h $PRINTER -p 9100

(-h -p -d are the only flags available in this version of netcat)

the printer will print the first line where its suppose to go, then the second line below the first, but all the way to the right of the paper like so:

[pre]
__________
|1st line |
|       2n|
|         |
|         |
~~~~~~~~~~
[/pre]

what i think is happening is that the printer is more or less just printing to the right and not really printing down. if i have three lines, it prints the first page exactly as you see it, then two other pages completely blank!
10 lines will be ~9 pages blank (unless they are really long lines, then its many more pages)

has anyone ever heard of this or knows a solution to this?

It sounds like your printer expects to get carriage returns and isn't. Newlines make it go to the next line, carriage returns make it go to the beginning of the line. It's simple enough to add them:

sed 's/$/\r/' < $FILE | netcat -h $PRINTER -p 9100

---------- Post updated at 02:40 PM ---------- Previous update was at 02:21 PM ----------

P.S: Have a UUOCA

1 Like

didn't do the trick, although maybe i will play around with that some to see if i cant make a solution.
if you have another solution though, i am all ears.

I was certain it was a carriage return, still sounds just like one... Pipe the output to hexdump -C | head and see if it really is converting newlines into two characters. There should be the two characters 0d 0a.

What is your printer?