#!/usr/bin/perl

# usage: grab-minmax-latlong.pl <filename.gps>
# or
# usage: cat filename | grab-minmax-latlong.pl

my @lat;
my @lon;

while(<>)
{
   if(/lat=\"([0-9\-.]+)\" lon=\"([0-9\-.]+)\"/)
   {
      push @lat, $1;
      push @lon, $2;
   }
}

@lat = sort {$a <=> $b} @lat;
@lon = sort {$a <=> $b} @lon;

print "min lat: ", shift @lat, "\n";
print "min lon: ", shift @lon, "\n";
print "max lat: ", pop @lat, "\n";
print "max lon: ", pop @lon, "\n";
