#!/usr/bin/gawk -f #/* vim: set filteype=awk : */ -*- awk -*- BEGIN{ FS = "." LastLearner="" LastDataset="" Sum=0 Count=0 } /^\/srv\/bronze\/stuff\/dj\/var\/weka\//{ #/^\/home\/donaldb\/var\/weka\//{ original=$0; sub(/^\/srv\/bronze\/stuff\/dj\/var\/weka\//, "", $0); # sub(/^\/home\/donaldb\/var\/weka\/.2.\//, "", $0); if((LastLearner==$2)) { split($0, temp, "Accuracy: "); sub("%", "", temp[2]) Sum=Sum+temp[2]; Count++ } else { if ((LastDataset==$1)) { print "Dataset: " LastDataset " & Learner: " LastLearner " had average accuracy: " Sum/Count; LastLearner = $2; split($0, temp, "Accuracy: "); sub("%", "", temp[2]) Sum=temp[2] Count=1; } else if ((LastDataset != "") && (LastLearner != "")) { print "Dataset: " LastDataset " & Learner: " LastLearner " had average accuracy: " Sum/Count; LastDataset=$1; LastLearner=$2; split($0, temp, "Accuracy: "); sub("%", "", temp[2]) Sum=temp[2]; Count=1; } else { LastDataset=$1; LastLearner=$2; split($0, temp, "Accuracy: "); sub("%", "", temp[2]) Sum=temp[2]; Count=1; } } } END{ }