sortCols() { cat <<EOF | gawk -F, '{;print $0;}'
EOF
}

transpose() {
cat data.txt | awk '{for (f = 1; f <= NF; f++)   a[NR, f] = $f  }  NF > nf { nf = NF } END {   for (f = 1; f <= nf; f++) for (r = 1; r <= NR; r++)     printf a[r, f] (r==NR ? RS : FS)  }' 
}

printRows(){

	local tmp=~/tmp/crap
	transpose > $tmp
	cat $tmp | awk '{OFS=",";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;}'

}

transpose|awk -F, '{OFS="\t"; for(i=1;i<=NF;i++) if ($i>= T1 && $i<T2) print NR,i}' T1=0 T2=0.15> 2d0.dat
transpose|awk -F, '{OFS="\t"; for(i=1;i<=NF;i++) if ($i>= T1 && $i<T2) print NR,i}' T1=0.15 T2=0.30> 2d15.dat
transpose|awk -F, '{OFS="\t"; for(i=1;i<=NF;i++) if ($i>= T1 && $i<T2) print NR,i}' T1=0.30 T2=0.60> 2d30.dat
transpose|awk -F, '{OFS="\t"; for(i=1;i<=NF;i++) if ($i>= T1) print NR,i}' 		T1=0.60 > 2d60.dat

gnuplot <<EOF
set xrange [0:102]
set yrange [0:580]
set xlabel "Instance Indices" font "Times-Roman,20"
set ylabel "Pre-Processor+Method Indices" font "Times-Roman,20"
set title "MRE Values for Each Instance In China Dataset" font "Times-Roman,20"
set terminal postscript eps
set output "chinaMREValues.eps
set key bottom right
set size 2.5,2.5
set pointsize 0.8
plot "2d0.dat" title "0.5> & >=0" with points 0 0,\
"2d15.dat" title "1.0> & >=0.5" with points 0 1,\
"2d30.dat" title "1.5> & >=1.0" with points 0 6 ,\
"2d60.dat" title "2> & >=1.5" with points 1 5
EOF
epstopdf chinaMREValues.eps
