shell script filters for lpr to append cr

shell script filters for lpr to append cr

Post by Peter Wyzl » Tue, 16 Jul 1996 04:00:00



Hello,


Date: 15.07.96

You wrote in /comp/unix/questions on "shell script filters for lpr to append
cr":

Quote:>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.

Look e.g. for the Linux Printing Howto (to be found at sunsite or

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

 
 
 

shell script filters for lpr to append cr

Post by Wong Pui Mi » Tue, 16 Jul 1996 04:00:00


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.
--
        __

  /      ( -------------  }  System Support Programmer
 (  =l=ll===============__}  Computing & Telecomm. Services Centre
  \   _  (                   Hong Kong Baptist University
   \_/ \__)                  224 Warerloo Road, Hong Kong (Tel:23397425)

 
 
 

shell script filters for lpr to append cr

Post by Brian Silve » Wed, 17 Jul 1996 04:00:00



> 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.

Should be simple. Try "unix2dos" (Maybe only Sun systems?).

Brian.
--

There are too many automated email-address-mailing-list-makers
on the 'net these days. It should be obvious what my email address
is if you'd like to send me email. I am sorry my Reply-To and From
addresses are misleading. You probably understand.


 
 
 

shell script filters for lpr to append cr

Post by Pui Ming WO » Thu, 18 Jul 1996 04:00:00


: >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.

:  
:        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";};
Seems only good for local printer. For remote printer, i tried the
following but don't know if it is right (gave me errors when actual tryout)
a. name the perl script above addcr.pl
b. create a shell script (the filter itself) called crfilter with 1 line
   /where/my/perlscript/addcr.pl | lpr -P remote
c. printcap entry as:
   lp22|22:\
   :sd=/var/spool/lpd/lp22:\
   :lp=:\
   :if=/where/i/put/myscript/crfilter

What have i done wrong ?
--
        __

  /      ( -------------  }  System Support Programmer
 (  =l=ll===============__}  Computing & Telecomm. Services Centre
  \   _  (                   Hong Kong Baptist University
   \_/ \__)                  224 Warerloo Road, Hong Kong (Tel:23397425)

 
 
 

shell script filters for lpr to append cr

Post by susan cassi » Fri, 19 Jul 1996 04:00:00





>> 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.

>Should be simple. Try "unix2dos" (Maybe only Sun systems?).

>Brian.
>--

>There are too many automated email-address-mailing-list-makers
>on the 'net these days. It should be obvious what my email address
>is if you'd like to send me email. I am sorry my Reply-To and From
>addresses are misleading. You probably understand.



If this is a serial printer, isn't this what the stty option onlcr does?

--
Susan Cassidy

 
 
 

1. NT/SCO lpr problem - filters CR/NL conversions, etc

I am trying to integrate SCO 3.2 and NT printing services.  I have problems
going either way.  I am (for the sake of brevity) only work with NT -> SCO
right now.

Facts:  The IP and and naming conventions are correct.
I can get the print job from NT to SCO
All local SCO print jobs work A-ok, although they are only text and Word
Perfect (for UNIX) files.
Printing TEXT files from NT -> SCO works great.

The problem is in printing non-text files (i.e., Word documents) from an NT
system to an HP Laserjet III on the SCO system.  The job gets to the queue
and comes out the printer, but the fonts get blown away.

Closest I have been able to determine is that the "default" print filter is
causing the problem.  I have transferred the Word document to the SCO
system via TCP and printed it with

lp -d LASERUP -T simple -r /usr2/robs/worddoc.doc

(where LASERUP is the HP Laserjet III on the SCO system)

When printing in this manner (telling it not to use the filter), the
document prints just fine, with no damage to the fonts.  Printing it any
other way scrambles the fonts.

Any help/suggestions are appreciated.  My current thought is that if I can
define a printer on the SCO system that does not use a print filter, I can
simply make it available to NT via lpr services, and be done with it.  I
cannot use the -r option (don't use a filter) from NT because lpr doesn't
support use of the -r flag for remote printers.

Thanks in advance for any assistance.  I appreciate your time to look at
this!
Rob

2. tcsh filename completion

3. echoing CR/LF from a shell script

4. Grammar checker for UNIX

5. simple shell script to append some letters to filenames...

6. installing Solaris 1.1.1B on a Sparc 5

7. In a shell script, how can I append a string to a file.

8. elm2.3

9. Shell script to append to crontab file

10. Panasonic CR-563, CR-562 and IBM external CR-563 compatible.

11. shell script being called by filter

12. (Filtering || Shell script) question

13. printing with a shell script as a filter