Calculate Average time of one column

Hello dears,

I have a log file with records like below and want to get a average of one column based on the search of one specific keyword.

2015-02-07      08:15:28        10.102.51.100   10.112.55.101   "kevin.c"       POST    /mainportal/webflow/customerprofile/smsEmailNotications/loadSubCategories.do?&msisdn=374355752&categoryCode=GSM_19   0.391   200     1740

suppose keyword is "loadSubCategories" and response time is on "column 8" (0.391)

This command gives a average of all response time of column 8 but not with the given keyword.

awk '{ total += $8; count++ } END { print total/count }' file.log001

please let me know how to write it.

Thanks.

A quick search of this forum should help you solve your requirement. See this one example using awk:

1 Like

Thank you mjf for your reply...

Below Script worked correctly...

awk '/getAuthServiceDetails.do/ {total += $8; count++} END { print total/count }' access.log00001