#! /bin/csh # # sort_ext ext_file percentile output_file # # sorts the extension file (specified by -e on modelfree command line) # after increasing SSE (2nd column). # prints the SSE(percentile) to standard output. # # uses the heapsort algorithm, see: # Aho et al. (1988) "The awk Programming Language", Addison-Wesley, p. 165 ff. # /bin/rm dummy nawk ' \ { \ if(NF==5) { \ printf("%5d %15.8f %10.3f %10.3f %10.3f\n", $1, $2, $3, $4, $5) \ } \ if(NF==4) { \ printf("%5d %15.8f %10.3f %10.3f\n", $1, $2, $3, $4) \ } \ if(NF==3) { \ printf("%5d %15.8f %10.3f \n", $1, $2, $3) \ } \ }' $1 > dummy sort -n +1 dummy > $3 get_percentile $3 $2