#!/usr/bin/perl # edit_MOLA_table.pl -- Similar to edit_PEDR_table.pl, but only outputs # latitudes and longitudes use Getopt::Std; getopts('a:b:c:d:e:'); $usage = "edit_MOLA_table.pl -a -b -c -d -e "; if (! ($opt_a && $opt_b && $opt_c && $opt_d && $opt_e)) { die "\nUsage: $usage\n\n"; } open(MOLATABLE,"$opt_a") || die "Could not open file.\n"; while() { $line = $_; if ( $line =~ /^(\S+)\s+(\S+)\s/ ) { #Grab the first two columns of data $longitude = $1; $latitude = $2; if (( $longitude >= $opt_b ) && ( $longitude <= $opt_c ) && ( $latitude >= $opt_d ) && ( $latitude <= $opt_e )) { #Check if the longitude and latitude #are within specified parameters print "$longitude\t$latitude\t1\n"; } } }