1837191 Members
2568 Online
110114 Solutions
New Discussion

Sed in model.orig file

 
SOLVED
Go to solution
support_5
Super Advisor

Sed in model.orig file

Dear all,

I have been toying with a sed that I use with no trouble on solaris in a BSD /etc/printcap output filter for a remote printer.

(We use this to handle messy postscript output from cups on a HPUX server to a XEROX docuprinter 350 that does not understand higher level postscript.)

To replace this functionality in HPUX, I have created two printers on a second HPUX server. One a dumb plotter and two a remote printer.

I direct the cups output from one server to a dumb plotter on the second server. The model.orig file is modified to include the postscript replacement sed. This printer then farms off the job to a remote printer on the same host which in turn farms off the job to the Docuprinter print server.

The insert line of the sed when included does not send output to the printer, however it works on its own.

I hope I am not making this way too complex but could not see a simpler way to do it.

Any thoughts would be gratefully accepted.

Here is model.orig file.

# @(#) $Header: /users/hpnp/odyssey/repository/sh/dumbplot_printer.psh,v 1.2 1999/04/21 06:52:12 hpnp Exp $
#
# lp interface for dumb plotter
#

copies=$4 # CHANGE COPIES

# Handle disable and cancel traps
trap "trap 15;kill -15 0;exit 0" 15

# The remaining arguments are files

shift; shift; shift; shift; shift
files="$*"

# Plot the spooled files

i=1
while [ $i -le $copies ]
do
for file in $files
do
cat "$file" 2>&1 | sed -e '{
s?/MediaPosition 1?/MediaColor(silver)?
s?/MediaPosition 0?/MediaColor(white)?
/%%LanguageLevel: 2/i %%DocumentMedia: white 595 842 0 white () %%+ silver 595 842 0 silver () %%+ yellow 595 842 0 yellow () %%+ blue 595 842 0 blue ()
}' | lp -d
done
i=`expr $i + 1`
done

exit 0
2 REPLIES 2
H.Merijn Brand (procura
Honored Contributor
Solution

Re: Sed in model.orig file

1. piggy-bag or dummy (redirecting) printers should have their interface script on /etc/lp/interface, not on .../model.orig
Piggy-bag printers do not only not need HPNP interfering, they don't want to.

The structure is OK, but it would be even more efficient to place the whole loop in one single lp command

# Plot the spooled files
(
i=1
while [ $i -le $copies ]
do
for file in $files
do
sed -e '{
s?/MediaPosition 1?/MediaColor(silver)?
s?/MediaPosition 0?/MediaColor(white)?
/%%LanguageLevel: 2/i %%DocumentMedia: white 595 842 0 white () %%+ silver 595 842 0 silver () %%+ yellow 595 842 0 yellow () %%+ blue 595 842 0 blue ()
}' < "$file" 2>&1
done
i=`expr $i + 1`
done
) | lp -s -d
exit 0
Enjoy, Have FUN! H.Merijn
support_5
Super Advisor

Re: Sed in model.orig file

I found that moving this file to /etc/lp/interface was the trick.

So thankyou very much,

Damo