-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsosus2gmt.pl
More file actions
executable file
·34 lines (29 loc) · 868 Bytes
/
sosus2gmt.pl
File metadata and controls
executable file
·34 lines (29 loc) · 868 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#! /usr/bin/env perl
#
# one-off to read SOSUS files... may be custom jobbed
# or heavily modified to not work as advertised by yours truly.
use Getopt::Std;
$help = <<"EOF";
Usage: sosus2gmt [locfile] [>> outfile]
locfile - file in SOSUS-like format
EOF
getopts('h');
$flag = print "$help" if $opt_h;
MAIN: { last MAIN if $flag;
# if no input file, specify hypoDD.reloc
if (@ARGV < 1) {
die "Need an input file!!";
}
else {
$infile = $ARGV[0];
}
open(FILEIN, "<$infile") or die "Can't open $infile: $!";
# this doesn't work, flags not available in MacOSX?? check man open(2)
#sysopen(FILEOUT, $outfile, O_EXCL | O_CREAT | O_WRONLY) or die "Can't open $outfile: $!";
while (<FILEIN>) {
chomp;
($datetime, $nsta, $stastr, $lat, $lon, $ncol1, $ncol2, $ncol3, $ncol4, $ncol5) = split(" ",$_);
print "$lon $lat\n";
}
close(FILEIN);
} # MAIN