Hello,
Date: 15.07.96
You wrote in /comp/unix/questions on "shell script filters for lpr to append
cr":
Look e.g. for the Linux Printing Howto (to be found at sunsite orQuote:>The scenario is:
>1. printing of text file from unix to remote printer on a pc
>running lpd
>2. printer does not do CR on LF
>3. result is that text printout become indented on every line
>4. lpd does not pay attention to print filters for remote printer
>Solution:
>1. define the remote printer as before
>2. define a "local" printer whose ifilter is simply a shell script
>to insert CRs before LF and then do the lpr to the remote printer
>Could someone tell me what should the shell script look like.
filter scripts. For avoiding the staircase effect it has the following:
------------------from--Linux-Printing-HOWTO----------->>------------
[...]
files a DeskJet 500 can understand, this DeskJet will print strange
things. For example, sending an ordinary Unix text file to a deskjet
results in literally interpreted newlines, and gets me:
This is line one.
This is line two.
This is line three.
ad nauseum. Printing a PostScript file to this spool would get a
beautiful listing of the PostScript commands, printed out with this
"staircase effect", but no useful output.
[...]
If we write a small shell script called filter that adds carriage
returns before newlines, the staircasing can be eliminated. So we
have to add in an if line to our printcap entry above:
lp|dj|deskjet:\
:sd=/var/spool/lpd/dj:\
:mx#0:\
:lp=/dev/lp0:\
:if=/var/spool/lpd/dj/filter:\
:sh:
A simple filter script might be:
#!perl
while(<STDIN>){chop $_; print "$_\r\n";};
If we were to do the above, we'd have a spool to which we could print
regular Unix text files and get meaningful results. (Yes, there are
four million better ways to write this filter, but [...]
---------------------------End----<<---------------------------------
The author of the HOWTO points to some magicfilters, developed for Linux.
But since they are Shell scripts they should/must run on other Unices as well.
\bye
Peter