shell scripting(little difficult for me).

Following is a output of command which shows cpu% of ABC machine (15 minute interval).

Code:
Host CPU% time
ABC  50.55 14 : 15
ABC  50.25 14 : 15
ABC  50.1 14 : 15
ABC  50.45 14 : 30
ABC  50.25 14 : 30

I would like to take above file as input .
Notice that for every 15 minuate interval there are some entries generated.
for example : for 14:15 there are 3 entries .
for 14:30 there are 2 entries.

I would like to get average of cpu% considering time.
say.
Code:
ABC  50.3 14 : 15
ABC  50.33 14 : 30
How would i achieve this?
 
Is there any specific way you wanted ? by awk ? , it can be easily done using shell script.

Code:
awk { a[$3]+=$2} END { for( i in a ) { print i , a[i] } }' filename

You will need to standardize the file by removing ":" within the time and then just use the above code.
 
Back
Top