#!/usr/bin/gawk -f #/* vim: set filteype=awk : */ -*- awk -*- BEGIN{ FS = " " BestLearner="" BestScore=0 LastDataset="" } { if((LastDataset==$2)) { if(BestScore <= $9) { BestLearner=$5; BestScore=$9; } } else { if ((LastDataset != "")) { print "For Dataset: " LastDataset " the best learner was: " BestLearner ", that had an average accuracy of: " BestScore; LastDataset=$2; BestLearner=$5; BestScore=$9; } else { LastDataset=$2; BestLearner=$5; BestScore=$9; } } } END{ }