scripting query - making the output look good.. (18 Views)
Reply
Super Advisor
Adam Noble
Posts: 366
Registered: ‎02-13-2001
Message 1 of 8 (18 Views)
Accepted Solution

scripting query - making the output look good..

Hi all,

I have written a nice little script (If I say so myself) which goes around all of the unix servers and brings back disk firmware, PDC revisions, Diagnostics revision and so on. It then outputs a number of lines for each server saying if action needs to be taken. The output content is exactly as I wish but I would like to make it more presentable and it will probably end up in a word
document.....sorry!!!

Basically this is a bit longwinded all I'm after is a good way of putting a header on each servers output so there is clear seperation. I can echo some hashes but wondered if anyone had a way of making the header look a bit better. Particularly if they are going to be pasted into a word doc....ha ha".

thanks

Please use plain text.
Honored Contributor
Steve Lewis
Posts: 725
Registered: ‎05-18-2000
Message 2 of 8 (18 Views)

Re: scripting query - making the output look good..

2 ideas:
The first is to make your document a .rtf file. If you look at a .rtf in a text editor you can see that it is readable and contains simple tags to format the data.

The second idea to to make your document a web page by using HTML tags - really simple, plus you can put your system info onto an intranet site with links to (a) recreate your documentation
(b) check for differences and display them.

Thats is what I have done.

By the way, there is a script called nickel which gives you excellent web page formatted system descriptions. I think you can get it from the porting centre, but I got it from the HP response centre.
Please use plain text.
Outstanding Contributor
Pete Randall
Posts: 16,205
Registered: ‎11-03-1996
Message 3 of 8 (18 Views)

Re: scripting query - making the output look good..

Adam,

How about the "banner" command? Something like

banner `hostname`

before you start each new server would definitely identify each.


Pete

Pete
Please use plain text.
Super Advisor
Adam Noble
Posts: 366
Registered: ‎02-13-2001
Message 4 of 8 (18 Views)

Re: scripting query - making the output look good..

Pete, Its just a bit primitive. I liked the html idea but the banner output is not that attractive.

Thanks tho
Please use plain text.
Outstanding Contributor
Pete Randall
Posts: 16,205
Registered: ‎11-03-1996
Message 5 of 8 (18 Views)

Re: scripting query - making the output look good..

Adam,

That's me - a simple, primitive sort of guy - I though I should mention it, in any case.


Pete

- no points, please -

Pete
Please use plain text.
Super Advisor
Adam Noble
Posts: 366
Registered: ‎02-13-2001
Message 6 of 8 (18 Views)

Re: scripting query - making the output look good..

oops sorry have 1
Please use plain text.
Honored Contributor
Oviwan
Posts: 692
Registered: ‎11-29-2005
Message 7 of 8 (18 Views)

Re: scripting query - making the output look good..

Hey

do a formatted output with perl, see link:

http://www.webreference.com/programming/perl/format/

Regards
Please use plain text.
Honored Contributor
Bill Hassell
Posts: 14,205
Registered: ‎05-29-2000
Message 8 of 8 (18 Views)

Re: scripting query - making the output look good..

Formatting plain ASCII has been around since the days of Teletypes and is as varied as there are system administrators. The most common techniques are to separate things with ASCII art (great Google search item) starting with stars, percents, equals, pluses, dashes, and underscores:

***********
%%%%%%%%%%%
===========
+++++++++++
-----------
___________

Noe the above illustrates the very first problem: proportional fonts. The ITRC uses common HTML code to accept the post that I made with a fixed spacing font like Courier. But you're reading the posting in a proportional font. So even though all 6 lines are exactly the same number of characters, they do not appear to be lined up. This becomes a *BIG* problem with tables such as bdf or cstm, etc. Here is a very nicely lined up bdfmegs listing (shown in ITRC proportional font):

bdfmegs -l /
File-System Mbytes Used Avail %Used Mounted on
/dev/vg00/lvol1 292 44 219 17% /stand
/dev/vg00/lvol3 288 138 149 48% /
/dev/vg00/lvol5 24 2 21 10% /oldhome
/dev/vg00/lvol6 1344 1288 56 96% /opt
/dev/vg00/lvol7 1592 1302 288 82% /usr
/dev/vg00/lvol8 4600 3931 664 86% /var

This looks great on my terminal screen but lousy in this posting -- and will look lousy in Word or any other word processor. ASCII boxes look good:

+------+
| |
| test |
| |
+------+

(in a fixed spacing font).

So the first step is to define a format to control the font -- The easiest is HTML where you can use
 ... 
to set a fixed font. Other markup languages such as nroff have a steep learning curve, and rtf looks something like this in Notepad:

{\rtf1\adeflang1025\ansi\ansicpg1252\uc1\adeff0\deff0\stshfdbch0\stshfloch0...

As mentioned, Nickel is a great tool that produces HTML from many different sources on an HP-UX machine and it's all standard POSIX shell stuff. Nickel has disappeared from the standard HP Response Center ftp site so I have attached a copy. The output is very generic HTML that can be moved to any web server.

Please use plain text.
The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation