- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- help inserting headings/title on a script
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-06-2010 04:36 AM
10-06-2010 04:36 AM
Please can somebody help, I wrote a small script that provides info on performance, but, I´ve not managed to put headings for the values to be displayed. For example:
N. of CPUs, CPU Utiliz, Mem Utili, Runqueue
4 50 44 3
4 57 34 2
4 45 45 1
Please can you help?
F.R.
Solved! Go to Solution.
- Tags:
- printf
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-06-2010 04:45 AM
10-06-2010 04:45 AM
SolutionThis seems pretty easy:
printf "%s %2s %2s %s\n" "C" "CU" "MU" "R"
echo "=============="
at the top of your script before you collect the sar or vmstat output.
That seems pretty self evident, so I'm assuming I'm missing something?
Doug
------
Senior UNIX Admin
O'Leary Computers Inc
linkedin: http://www.linkedin.com/dkoleary
Resume: http://www.olearycomputers.com/resume.html
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-06-2010 04:50 AM
10-06-2010 04:50 AM
Re: help inserting headings/title on a script
Thanx for your prompt response, but I´m new into scripting, the idea below the headings is to use gbl_cpu_util, gbl_mem_util, etc, and use that file as an advise syntax file to be used with glance. Pls can you explain your code, if is not asking too much.
regards
FR
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-06-2010 05:08 AM
10-06-2010 05:08 AM
Re: help inserting headings/title on a script
- What tools are you using? Shell (which?) Awk?
- What tools can you use? Perl?
- Where does the data come from?
- What should the result ideally look like?
- If you can, provide a .TXT attachement with code and data examples, in addition to the posted text to get a clear view on spaces/spacing.
Doug unconditionally uses 2 disting methods of printing. The crude 'echo' and the refined printf with full formatting control.
When dealing with header lines, I often use conditional prints like (perl)
print "heading\n" unless $lines++
in AWK I might use BEGIN { } or (NR=-1)
Please help us help you!
Regards,
Hein
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-06-2010 05:13 AM
10-06-2010 05:13 AM
Re: help inserting headings/title on a script
I am using this comand:(opt/perf/bin/glance -adviser_only -iterations 5 -j10 -syntax /tmp/fr/advtest > /tmp/fr/streess.out )
with that adviser file: (print " ", gbl_statdate, " ", gbl_stattime
print "number of CPUs online,",gbl_active_cpu
print "Total CPU utilization, ",gbl_cpu_total_util
print "Average n of processes using CPU,",gbl_cpu_queue
print "% of physical mem in use, ",gbl_mem_util
print "% of swap space available,",gbl_swap_space_util
print "Average of time of all disks being used,",gbl_disk_util
print "% of time of busiest disk had I/O in progress, ",gbl_disk_util
)
but for easy formating in excel I want to change the layout, so puting the headings in one line, and the values at the bottom.
regards
FR
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-06-2010 05:36 AM
10-06-2010 05:36 AM
Re: help inserting headings/title on a script
Hmmm, some of us do not have those tools handy, but they know what to do with the input/output if shown in detail.
Given the width of the heading the current format with heading on left would seem 'nicer' than the classic heading on top.
Anyway,
Can you not just re-arrange those 'nice' print lines with ugly (for you) result into really ugly print lines with nice results?
Something like (and you complete...) :
print "number of CPUs online,Total CPU utilization,Average n of processes using CPU,% of physical mem in use"...
print gbl_active_cpu, gbl_cpu_total_util,gbl_cpu_queue,gbl_mem_util ....
In a pinch you can teach Excell to rotate the data, or post process the text file to do so. For example with perl something like:
$ perl -lne '($nam[$i],$val[$i++]) = split /,/ }{ print join q(,),@nam; print join q(,),@val' < bad > good
Btw... you had gbl_disk_util used twice.
Good luck,
Hein
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-06-2010 05:50 AM
10-06-2010 05:50 AM
Re: help inserting headings/title on a script
I tought you were going to show yours:)?
FR
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-12-2010 04:49 AM
10-12-2010 04:49 AM
Re: help inserting headings/title on a script
The answers provided did shed some light into it.
thanx
FR