Here=`pwd` cd $HOME/work/mine/trunk/doc/06/markland for i in 0 1 2 3 do printf "\n\n----| $i |-------\n\n" silap -n 500 cluster${i}.data433wekaClusteredSorted.csv |tee /tmp/$$ gawk -F, ' function trim(x) { sub(/^ */,"",x); sub(/ *$/,"",x); return x } Pass==1 { Names[++Names[0]]=$1 } Pass==2 { $1 = trim($1) sub(/\%/,"",$3); Data[$1]=$3 } END { for(i=1; i<=Names[0]; i++) { j= Names[i]; print (j in Data) ? Data[j] : 0 }} ' Pass=1 $Here/15.in Pass=2 /tmp/$$ > 15.selected.$i done paste 15.selected.* | sort -n | cat -n > 15.dat wc cluster*data433wekaClusteredSorted.csv ls 15.selected.* gnuplot <