#!/usr/local/bin/perl -w # Selects lines from file that match tag in column c $t = 570 ; $c = 3 ; $o = "tmp" ; $do_o = 1 ; # How to override min and max values with command line eval "\$$1=\$2" while @ARGV && $ARGV[0]=~ /^(\w+)=(.*)/ && shift; $c--; open (O,">$o") if $do_o ; while( <> ) { s/^\s*//; @f = split ; if ( $f[$c] == $t ) { print ; } else { print O if $do_o ; } }