Operating System - HP-UX
1832765 Members
3380 Online
110045 Solutions
New Discussion

Re: (Think tank) Scripting question

 
SOLVED
Go to solution
Jeffrey Davis_1
Frequent Advisor

(Think tank) Scripting question

I have some scripts that gather and print information from systems. I would like to print the report 'landscape' on the printer and possibly even bold/italicize certain info from the report. Any ideas on how I would get this to work without having to make changes to the printer itself. I'm sure this can be done, I just can't come accross any information anwhere where I would put these statements in my script.
Thanks in advance,
8 REPLIES 8
Uday_S_Ankolekar
Honored Contributor

Re: (Think tank) Scripting question

Hi,

You can use thiese options in lp command
with o option

-oi for italic
-olandscape for landscape
-oweight3 for bold

for exapmple

lp -d -oi olandscape filename ..

-USA..
Good Luck..
Wilfred Chau_1
Respected Contributor

Re: (Think tank) Scripting question

I recommend using enscript. You can get the depot from this url:
http://hpux.connect.org.uk/hppd/hpux/Gnu/enscript-1.6.1/


To print 2 pages on 1 page and in landscape,
enscript -r -2 -P
Jeffrey Davis_1
Frequent Advisor

Re: (Think tank) Scripting question

Hi all, either this can't be done or I have stumped all of you.
I can print landscape fine.
I don't want to print the whole report in bold, just certain header parts inside the report.
I can't think of any way to accomplish this.
Maybe someone else has some ideas, without me having to import it to a word processor.
Robin Wakefield
Honored Contributor
Solution

Re: (Think tank) Scripting question

Hi Jeffrey,

I use the following functions within a script to underline or make bold certain characters:

function underline
{
echo $*|awk '{ for (i=1;i<=length($0);i++)
{ printf ("_\b%s",substr($0,i,1)) }
}'

}

function make_bold
{
echo $*|awk '{ for (i=1;i<=length($0);i++)
{ printf ("%s\b%s\b%s\b%s",substr($0,i,1),substr($0,i,1),substr($0,i,1),substr($0,i,1)) }
}'

so to use it, I'd have something like:

...
/etc/lvdisplay $I | grep -q -i stale
if [ $? -eq 0 ] ; then
echo `make_bold Warning` - LV $I has stale extents
fi
...

in my script, the output would get sent to the printer with "Warning" in bold, the rest normal.

Not sure about italic, I'd have to do some digging.

Rgds, Robin.
A. Clay Stephenson
Acclaimed Contributor

Re: (Think tank) Scripting question

Hi Jeffrey:

This is a little tricky. The simple answer is that you need to include the escape sequences in the data stream. The tricky part is that the escape sequeneces differ from printer model to printer model/manufacturer.

There are several commercial products that will do what you want. One is called UnForm. http://www.unform.com. You can also search the
HP-UX Porting Centre for text processing. Another method would be to embed commands like [Italics]
[Italics Off]
[Bold]
[Bold Off]
within your text data stream and then write a post-processor in awk or perl to substitute the appropriate escape sequences in the output stream. My weapon of choice would be UnForm but I've already bought it.

Regards, Clay
If it ain't broke, I can fix that.
Jeffrey Davis_1
Frequent Advisor

Re: (Think tank) Scripting question

Hi all, Can you tell me what the URL is for the porting centre. Can't seem to get it right.
Thanks,
Darrell Allen
Honored Contributor

Re: (Think tank) Scripting question

One porting center is at:
http://hpux.cs.utah.edu/

Darrell
"What, Me Worry?" - Alfred E. Neuman (Mad Magazine)
A. Clay Stephenson
Acclaimed Contributor

Re: (Think tank) Scripting question

http://gatekeep.cs.utah.edu/hppd/hpux/
If it ain't broke, I can fix that.