sortCols() { cat sumWinValues.txt | awk 'BEGIN{FS=","; OFS=","}{for(i=1;i<=NF;i++) $i=$i*100/(101*7); print $103,$95,$99,$92,$93,$96,$97,$98,$100,$101,$58,$59,$4,$5,$102,$13,$14,$94,$67,$68,$71,$85,$86,$17,$72,$78,$6,$70,$79,$7,$89,$76,$77,$90,$62,$8,$31,$32,$36,$84,$49,$50,$69,$87,$88,$63,$74,$9,$65,$18,$83,$56,$2,$27,$40,$41,$81,$82,$10,$47,$45,$73,$91,$53,$66,$3,$60,$54,$57,$35,$22,$23,$80,$26,$38,$11,$51,$16,$15,$44,$42,$52,$61,$39,$43,$34,$29,$48,$25,$24,$33,$12,$20,$30,$55,$64,$46,$19,$28,$37,$21,$75
}' 
}


printRows(){

	local rows="20 17 2 6 3 9 15 5 13 8 7 18 14 11 19 12 16 4 10 21"
	local tmp=~/tmp/crap
	sortCols > $tmp

	for val in $rows; do
		cat $tmp | awk 'NR=='$val'{print $0}'
	done

}

# separate data into subsets w.r.t. win percentage
printRows |gawk -F, '{OFS="\t"; for(i=1;i<=NF;i++) if ($i>= T1 && $i<T2) print NR,i}' T1=0 T2=15> 2d0.dat
printRows |gawk -F, '{OFS="\t"; for(i=1;i<=NF;i++) if ($i>= T1 && $i<T2) print NR,i}' T1=15 T2=30> 2d15.dat
printRows |gawk -F, '{OFS="\t"; for(i=1;i<=NF;i++) if ($i>= T1 && $i<T2) print NR,i}' T1=30 T2=60> 2d30.dat
printRows |gawk -F, '{OFS="\t"; for(i=1;i<=NF;i++) if ($i>= T1) print NR,i}' T1=60 > 2d60.dat

gnuplot <<EOF
set xrange [0:35]
set yrange [0:102]
set xlabel "Dataset Indices" font "Times-Roman,20"
set ylabel "Pre-Processor+Method Indices" font "Times-Roman,20"
set title "Total - Percentage Win Values "font "Times-Roman,20"
set terminal postscript eps
set output "allWinValues.eps
set key bottom right
set size 0.7,1.5
set pointsize 1
plot "2d0.dat" title "15%> & >=0%" with points 0 0,\
"2d15.dat" title "30%> & >=15%" with points 0 1,\
"2d30.dat" title "60%> & >=30%" with points 0 6 ,\
"2d60.dat" title ">=60%" with points 1 5
EOF
epstopdf allWinValues.eps
