The input is a nginx log file with many requests of this syntax:
130.37.129.78 - - [25/Jun/2011:12:55:10 +0000] "GET /ganglia/graph.php?m=load_one&z=small&c=cluster1&h=xen02.das3.cs.vu.nl&l=e2ecff&v=0.00&x=0.32&n=0&r=hour&su=1&st=1309006507 HTTP/1.0" 200 7085 "http://130.37.197.12/ganglia/index.php" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:5.0) Gecko/20100101 Firefox/5.0" request:0.252
I am parsing this log file line by line and extracting the request: value from each line and computing their average. Could you help me as to how to extract the value after the "request:" string from each line.
---------- Post updated at 02:47 PM ---------- Previous update was at 02:43 PM ----------
I need to know how your logfile looks like .
Does it only contain lines that ends with a string "request:<value>" ?
If not then please post a representative example of how does your logfile look like (with all the lines, not only those that have the "resquest:<value>", so we can then be more accurate in the line selection before extracting the value and calculating the average
Wow, that is perfect. Just what I needed in one line
One more thing, is there a way to store the value of average in another variable, since I am having a shell script which runs the above script inside it, so I would like to store the average value into a variable.