HPE GreenLake Administration
- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- shell script
Operating System - HP-UX
1833385
Members
3531
Online
110052
Solutions
Forums
Categories
Company
Local Language
back
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
back
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
Discussion Boards
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Topic Options
- 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
04-13-2003 11:08 PM
04-13-2003 11:08 PM
shell script
Hello,
I am not so savy in writing awk scripts .Please guide me to write a script to get the required values.
The senario is as follows.
The output of a command (which is the output of the command iostat in solaris) is as follows.
iostat -D -l 2 1 4
sd0 sd6
rps wps util rps wps util
0 5 3.0 0 0 0.0
0 0 0.0 0 0 0.0
0 0 0.0 0 0 0.0
0 0 0.0 0 0 0.0
Here I need to store the disk names (viz.sd0 and sd1) and also for each disk, the utilization column,i.e the thrid field for each disk needs to added and the average should be taken and to be stored in another variable.Here the disks is not alwas same it depends on the number of disk available on the system.
Thanks in Advance,
Regards,
Raghu
I am not so savy in writing awk scripts .Please guide me to write a script to get the required values.
The senario is as follows.
The output of a command (which is the output of the command iostat in solaris) is as follows.
iostat -D -l 2 1 4
sd0 sd6
rps wps util rps wps util
0 5 3.0 0 0 0.0
0 0 0.0 0 0 0.0
0 0 0.0 0 0 0.0
0 0 0.0 0 0 0.0
Here I need to store the disk names (viz.sd0 and sd1) and also for each disk, the utilization column,i.e the thrid field for each disk needs to added and the average should be taken and to be stored in another variable.Here the disks is not alwas same it depends on the number of disk available on the system.
Thanks in Advance,
Regards,
Raghu
he who can does he who cannot, preaches
1 REPLY 1
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-13-2003 11:54 PM
04-13-2003 11:54 PM
Re: shell script
$ cat getutil.awk
BEGIN{}
{
if (NR==1) { split($0,disks);getline; }
if (NR==2) { getline; }
utilcol=3;
for (ct=1;ct <= ndisks; ct++)
{
disks[ct,sum] += $utilcol;
utilcol += 3;
if (utilcol > NF) { break; }
}
}END{
for (ct=1;ct<=ndisks;ct++){
printf ("%s %f\n", disks[ct], disks[ct,sum]/(NR-2));
}
}
<<<<<<<<<<<<<<<<
call as follows -
$ export ndisks=2
$ iostat -D -l $ndisks 1 4 | awk -f getutil.awk -v ndisks=$ndisks
HTH.
- ramd.
BEGIN{}
{
if (NR==1) { split($0,disks);getline; }
if (NR==2) { getline; }
utilcol=3;
for (ct=1;ct <= ndisks; ct++)
{
disks[ct,sum] += $utilcol;
utilcol += 3;
if (utilcol > NF) { break; }
}
}END{
for (ct=1;ct<=ndisks;ct++){
printf ("%s %f\n", disks[ct], disks[ct,sum]/(NR-2));
}
}
<<<<<<<<<<<<<<<<
call as follows -
$ export ndisks=2
$ iostat -D -l $ndisks 1 4 | awk -f getutil.awk -v ndisks=$ndisks
HTH.
- ramd.
HPE Software Rocks!
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
Company
Events and news
Customer resources
© Copyright 2025 Hewlett Packard Enterprise Development LP