#!/usr/local/bin/perl # ~/perl/pcol.p f=2 t=5 w=9 th=0.1 OR show=4 left=2 # show adapts threshold so that show entries are shown. # also the left hand left entries are automatically shown sub bynumber { $a <=> $b; } $sep='[ \t]+'; $f=1; $t=2; $w=7; $th=-1.0; $show=0; $left=0; $smallest=0; $abs=0; $endnewline = 0 ; # How to override min and max values with command line eval "\$$1=\$2" while @ARGV && $ARGV[0]=~ /^(\w+)=(.*)/ && shift; $f--; $t--; if ($t<$f) { $t = $f ; } $num = $t - $f + 1 ; if($th > 0.0 || $show > 0 ) { $spacer = "." x ($w) ; } $white = " " x ($w) ; while (<>) { if ($_ ne "\n") { s/\[ ([^\]]*)\]/\[$1\]/g; s/EN 2/EN:2/g; # s/CT\/N/CT N/g; s/CT2\/N/CT2 N/g; s/X2 2/X2:2/g; # s/Infinity/0/g; # @fields = split($sep,$_); if($show>0) { @sorted = sort bynumber @fields[$f..$t] ; $th = $sorted[$num - $show - 1] ; } for ( $i = $f ; $i <= $t ; $i++) { if ( ( ($show==0) && ($th < 0.0) ) || ( ( (($smallest==0)&&($fields[$i] > $th)) || (($smallest==1)&&($fields[$i] < $th)) )) || ( ($abs==1) && ( (($smallest==0)&&($fields[$i] < - $th)) || (($smallest==1)&&($fields[$i] > - $th)) )) || ( $i < $f + $left ) ) { print substr($fields[$i].$white,0,$w) ; } else { print $spacer; } print " "; } } print "\n" ; } if ( $endnewline ) { print "\n" ; }