#!/bin/bash function extract() { # Expect the uncompressed log files of one site in the # current directory. for i in *; do # Get the suffix from the filename. export suffix=`echo $i | awk -F . '{print $NF}'` # Output space separated key value pairs (day/hits) awk -v "day=$suffix" 'BEGIN {hits=0} /GET \/ HTTP.*Googlebot/ {hits++} END {print day" "hits}' $i done } # gnuplot does not like its input data unordered. # Printing results may take a while. extract | sort -n