Skip to content

Instantly share code, notes, and snippets.

@pooooch
Created October 26, 2012 13:06
Show Gist options
  • Save pooooch/3958684 to your computer and use it in GitHub Desktop.
Save pooooch/3958684 to your computer and use it in GitHub Desktop.
time tar zxvf weather.tz -O 2>&1 | awk '{if(substr($2,0,4)>=1996){a=$1" "substr($2,0,7);split($3,max,":");split($4,min,":");arr[a]+=max[2]-min[2];num[a]+=1}}END{for(i in arr) print i,arr[i]/num[i]}' | awk '{if(max[$1]<$3){max[$1]=$3;date[$1]=$2;} else if(max[$1]==$3){date[$1]=date[$1]" "$2}}END{for(i in max) print i,date[i],max[i]}' > res
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment