Operating System - HP-UX
1753774 Members
7034 Online
108799 Solutions
New Discussion юеВ

Re: Trimming of script output

 
Khalid Shakoor
Regular Advisor

Trimming of script output


Dear Guruz,
I have a script which check the host status, uptime, Application status from one hostname define file name is telist and send the output in log file.
This script is working fine for me but i have one issue, itтАЩs not showing the proper output of (|) like below you can see
| Srl | Host Name | HOST ALIVE | APPS RUNNING | UPTIME |
| 1 | kw01ksedgd01 | UP | UP | 12:04:31 up 74 days, 34 min, 0 users, load average: 0.23, 0.08, 0.02 |
| 2 | kw01ksedgd02 | UP | UP | 12:04:32 up 107 days, 20:11, 1 user, load average: 0.00, 0.00, 0.00 |
In above output the uptime output of all servers started with same point but in the end is not same.
I am attaching the script and log file for more details.
I will appreciate of some one share with me how to manage the output.
Thanks
khalid


5 REPLIES 5
Khalid Shakoor
Regular Advisor

Re: Trimming of script output

em trying to upload script and log file but i giving me error.Below is the link to download the zip file.
http://rapidshare.com/files/432179780/script.zip

Thanks
Khalid
Hein van den Heuvel
Honored Contributor

Re: Trimming of script output

Khalid,

That is a POS download site you pointed us to.
It is spending more time and bandwith trying to fool its potential users into upgrading with messages like 'all free downloads are in use' and 'avoid waiting' nonsense than it would take to actually download the silly 2KB.
It must have send me 200 kb of nonsense in the process. :-(

Just copy the script into a .TXT file and attach already?

As you do so, you might want to include few more example input, and output lines.

Also, your explanation of what is wrong is not at all clear to me. Maybe other readers are smarter, but please re-try or ask a friend to review/interpret.

fwiw,
Hein

Dennis Handly
Acclaimed Contributor

Re: Trimming of script output

>I'm trying to upload script and log file but it's giving me error.

What was the error? It should work as long as it is < 1 Mb. You would have problems downloading it if it was .zip using IE. (Use .ZIP instead.)
As Hein said, it was hard to use your URL.

Khalid Shakoor
Regular Advisor

Re: Trimming of script output

Let me try to upload script file from IE as its only 2.72 KB.

Thanks
Khalid
Laurent Menase
Honored Contributor

Re: Trimming of script output

use
printf "| %5d | %-20s | %-4s | %-40s |\n" \
"$tsrl" "$te" "$hstat" "$astat" \
"$aupt"