transpose() { cat - | gawk -F, 'BEGIN{OFS=","} NR == 1 { n = NF for (i = 1; i <= NF; i++) row[i] = $i next } { if (NF > n) n = NF for (i = 1; i <= NF; i++) row[i] = row[i] "," $i } END { for (i = 1; i <= n; i++) print row[i] }' } # below sort is for methods sortCols1() { cat - | gawk -F, 'BEGIN{FS=","; OFS=","}{for(i=1;i<=NF;i++) $i=$i; print $102 ,$94 ,$98 ,$91 ,$92 ,$95 ,$96 ,$97 ,$99 ,$100 ,$57 ,$58 ,$3 ,$4 ,$101 ,$12 ,$13 ,$93 ,$66 ,$67 ,$70 ,$84 ,$85 ,$16 ,$71 ,$77 ,$5 ,$69 ,$78 ,$6 ,$88 ,$75 ,$76 ,$89 ,$61 ,$7 ,$30 ,$31 ,$35 ,$83 ,$48 ,$49 ,$68 ,$86 ,$87 ,$62 ,$73 ,$8 ,$64 ,$17 ,$82 ,$55 ,$1 ,$26 ,$39 ,$40 ,$80 ,$81 ,$9 ,$46 ,$44 ,$72 ,$90 ,$52 ,$65 ,$2 ,$59 ,$53 ,$56 ,$34 ,$21 ,$22 ,$79 ,$25 ,$37 ,$10 ,$50 ,$15 ,$14 ,$43 ,$41 ,$51 ,$60 ,$38 ,$42 ,$33 ,$28 ,$47 ,$24 ,$23 ,$32 ,$11 ,$19 ,$29 ,$54 ,$63 ,$45 ,$18 ,$27 ,$36 ,$20 ,$74 }' } # below sort is for instances sortCols2() { cat - | gawk -F, 'BEGIN{FS=","; OFS=","}{for(i=1;i<=NF;i++) $i=$i; print $45 ,$54 ,$78 ,$70 ,$81 ,$76 ,$44 ,$9 ,$84 ,$89 ,$66 ,$67 ,$74 ,$42 ,$71 ,$39 ,$51 ,$77 ,$23 ,$13 ,$87 ,$17 ,$80 ,$88 ,$86 ,$63 ,$73 ,$55 ,$92 ,$46 ,$43 ,$60 ,$47 ,$57 ,$91 ,$90 ,$82 ,$49 ,$75 ,$56 ,$62 ,$85 ,$61 ,$26 ,$24 ,$2 ,$3 ,$15 ,$58 ,$48 ,$65 ,$29 ,$33 ,$18 ,$41 ,$64 ,$32 ,$83 ,$53 ,$36 ,$38 ,$22 ,$25 ,$19 ,$11 ,$35 ,$68 ,$20 ,$16 ,$40 ,$52 ,$30 ,$5 ,$28 ,$27 ,$37 ,$31 ,$72 ,$50 ,$69 ,$14 ,$4 ,$21 ,$6 ,$79 ,$34 ,$12 ,$94 ,$8 ,$7 ,$59 ,$10 ,$93 }' } for i in *mreValuesToWrite.txt;do cat $i | sortCols2 > instanceSorted.dat # sort for instances cat instanceSorted.dat | transpose > transposed.dat # transpose for unity of axis w.r.t other figures cat transposed.dat | sortCols1 > sorted.dat # sort for methods #cat methodSorted.dat | transpose > sorted.dat echo "${i%mreValuesToWrite.txt}" cat sorted.dat |awk -F, '{OFS="\t"; for(i=1;i<=NF;i++) if ($i>= T1 && $i 2d0.dat cat sorted.dat |awk -F, '{OFS="\t"; for(i=1;i<=NF;i++) if ($i>= T1 && $i 2d25.dat cat sorted.dat |awk -F, '{OFS="\t"; for(i=1;i<=NF;i++) if ($i>= T1 && $i 2d50.dat cat sorted.dat |awk -F, '{OFS="\t"; for(i=1;i<=NF;i++) if ($i>= T1) print NR,i}' T1=1 > 2d75.dat gnuplot < & >=0" with points 6 5,\ "2d25.dat" title "0.5> & >=0.25" with points 5 5,\ "2d50.dat" title "1> & >=0.5" with points 8 5,\ "2d75.dat" title ">=1" with points 7 5 EOF epstopdf "${i%mreValuesToWrite.txt}MREValues.eps" done