AIXSolarisAdmin
MIS
Example file:
sda 0.00 0.99 7.92 55.45 95.05 815.84 14.38 0.06 1.00 0.88 5.54
sdb 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
sdc 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
sdd 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
sda 0.00 0.00 4.00 9.00 32.00 200.00 17.85 0.06 4.92 4.62 6.00
sdb 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
sdc 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
sdd 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
sda 0.00 0.99 7.92 55.45 95.05 815.84 14.38 0.06 1.00 0.88 5.54
sdb 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
sdc 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
sdd 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
which prints this extracted sample data:
But what I want is a cumulative total for each device instead of a line for each (for example):
sda 19.32
sdb 2.44
sdc 8.00
sdd 0.00
...
...
sdak 0.81
There may be tens or hundreds of devices.
Thanks
sda 0.00 0.99 7.92 55.45 95.05 815.84 14.38 0.06 1.00 0.88 5.54
sdb 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
sdc 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
sdd 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
sda 0.00 0.00 4.00 9.00 32.00 200.00 17.85 0.06 4.92 4.62 6.00
sdb 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
sdc 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
sdd 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
sda 0.00 0.99 7.92 55.45 95.05 815.84 14.38 0.06 1.00 0.88 5.54
sdb 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
sdc 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
sdd 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
Code:
# awk '{dev[i]=$1; await[j]=$10; for (i in dev); for (j in await); print dev[i]" "await[j]}' x
Code:
sda 3.45
sdb 0.00
sdc 0.00
sdd 0.00
sda 2.90
sdb 0.00
sdc 0.00
sdd 0.00
sda 0.00
sdb 0.00
sdc 0.00
sdd 0.00
But what I want is a cumulative total for each device instead of a line for each (for example):
sda 19.32
sdb 2.44
sdc 8.00
sdd 0.00
...
...
sdak 0.81
There may be tens or hundreds of devices.
Thanks