[Linux] need some help with printer filter.

Nick Simicich njs@scifi.squawk.com
Thu, 12 Oct 2000 20:59:26 -0400


Hmmm, won't this work?

while (<stdin>) {
	chomp;
	print $_,"\r\n";
}

[njs@scifi njs]$ echo -e "foo\nbar\nbaz" | od -cx
0000000   f   o   o  \n   b   a   r  \n   b   a   z  \n
        6f66 0a6f 6162 0a72 6162 0a7a
0000014
[njs@scifi njs]$ echo -e "foo\nbar\nbaz" | perl -e 'while (<stdin>) {
chomp; print $_,"\r\n";}' | od -cx
0000000   f   o   o  \r  \n   b   a   r  \r  \n   b   a   z  \r  \n  \0
        6f66 0d6f 620a 7261 0a0d 6162 0d7a 000a
0000017
[njs@scifi njs]$

Looks like it works to me, if you ignore the little endian stupidity.

At 07:09 PM 10/11/2000 -0400, Ronnie wrote:
>I am trying to print to a DOS printer, flat ASCII text.
>
>I have the standard 'stair step' problem, and have not been able to
>'write'
>a simple filter to correct it.
>I know the problem is the ^J ^M expected on a DOS printer, where UNIX
>is only sending a ^J
>
>I tried to modify a pearl script, then tried in sed & awk.
>Nothing I tried would output a file with a ^M at the end of each line?
>I don't 'think' I want to do anything ot the print job but translate the
>EOL's.
>I do not use X, and the version of Linux I am using doesn't have
>'printool' etc..
>I am using a OLD version od Slackware.
>
>The printer is in another department, so changing its configuration is
>out of the question.
>
>Any thoughts would be appreciated....
>
>Thanks & see you at the meeting.
>
>
>_______________________________________________
>Linux mailing list
>Linux@flux.org
>http://www.flux.org/mailman/listinfo/linux
>
--
We will fight for bovine freedom, And hold our large heads high.
We will run free, with the buffalo or die! Cows with Guns.
 - Dana Lyons, Cows With Guns
Nick Simicich mailto:njs@scifi.squawk.com
http://scifi.squawk.com/njs.html -- Stop by and Light Up The World!