#!/usr/local/bin/perl # undetect.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; } $c=21 ; # column that contains the marker, which should be positive for a print $allcomments = 0 ; $zero = 0 ; # set zero=1 to look for zeros $follow = 0 ; # to see the line following a match, set follow=1 $comment = 0 ; # whether to omit lines by commenting them out. eval "\$$1=\$2" while @ARGV && $ARGV[0]=~ /^(\w+)=(.*)/ && shift; $c-- ; $donecomment = 0 ; # keeps track of number of original comment lines shown while (<>) { if ($_ ne "\n") { s/^\s+// ; if ( (/^\#/) ) { if ( !$donecomment || $allcomments ) { print ; } $donecomment = 1 ; } else { @fields = split(' ',$_); if ( ($fields[$c] > 0)^($zero) ) { print ; if ( $follow > 0 ) { for ( $f = 1 ; $f <= $follow ; $f ++ ) { $_ = <> ; print ; } } } elsif ($comment) { # show the lines but suppress from gnuplot print "\#$_" ; } } } }