in reply to Re^2: Find overlap
in thread Find overlap
i'm not sure if i get the problem right but this script will find the min of all values in column 2 of all given files and the max of all values in column 3.
you just call it with the file names as arguments.
#!/usr/bin/perl -w use strict; my $min = undef; my $max = undef; foreach (@ARGV) { open(F, "< $_"); while(my $line = <F>) { chop($line); $line =~ s/[\ \t]+/:/g; my @p = split(/:/,$line); if(!defined($min)) { $min = $p[1]; } if(!defined($max)) { $max = $p[2]; } if($p[1] < $min) { $min = $p[1]; } if($p[2] > $max) { $max = $p[2]; } } close(F); } print "$min $max\n";
|
|---|