#!/usr/bin/perl

@txt = `cat raw*`;

$line_number = 1;
foreach $line (@txt)
{
   if ($line =~ m/(\d+)(\d\d\.\d+)([NS])[^\d]*(\d+)(\d\d\.\d+)([WE])/) {
      # $1 is lat degrees
      # $2 is lat minutes
      # $3 is lat direction N/S
      # $4 is long degrees
      # $5 is long minutes
      # $6 is long direction E/W

      $lat_degrees = $1;
      $lat_sub = $2/60;
      $lat_direction = $3;
      $long_degrees = $4;
      $long_sub = $5/60;
      $long_direction = $6;

      $lat_sub =~ s/^0\.//g;
      $long_sub =~ s/^0\.//g;

      if ($long_direction eq 'W')
      {
         print "-";
      }
      print "$long_degrees" . "." . "$long_sub,";

      if ($lat_direction eq 'S')
      {
         print "-";
      }
      print "$lat_degrees" . "." . "$lat_sub:";
      print "red5:$line_number\n";
      $line_number++;
   }
}



