add spot2csv.pl
authorminima <minima>
Tue, 2 Jan 2001 21:12:08 +0000 (21:12 +0000)
committerminima <minima>
Tue, 2 Jan 2001 21:12:08 +0000 (21:12 +0000)
Changes
perl/spot2csv.pl [new file with mode: 0755]

diff --git a/Changes b/Changes
index d92166cc4758bed3b8f2381206bae77518640cf7..905506b9281b1d272552aa960907c829f5952ca3 100644 (file)
--- a/Changes
+++ b/Changes
@@ -1,6 +1,7 @@
 02Jan01=======================================================================
 1. added a help file for forward/latlong and updated the admin manual to
 match. (g0vgs)
+2. Add spot2csv.pl to convert spot files into tab delimited .csv format.
 31Dec00=======================================================================
 1. add lat/long info to show/prefix
 30Dec00=======================================================================
diff --git a/perl/spot2csv.pl b/perl/spot2csv.pl
new file mode 100755 (executable)
index 0000000..100a8d3
--- /dev/null
@@ -0,0 +1,39 @@
+#!/usr/bin/perl -w
+#
+# convert a DXSpider Spot file to csv format
+#
+# usage: spot2csv.pl <filename> ...
+#
+# Copyright (c) 2001 Dirk Koopman G1TLH
+#
+# $Id$
+# 
+
+# make sure that modules are searched in the order local then perl
+use DXUtil;
+
+use strict;
+
+die "usage: spot2csv.pl <filename> ....\n" unless @ARGV;
+
+for (@ARGV) {
+       unless (open IN, $_) {
+               print STDERR "cannot open $_ $!\n";
+               next;
+       }
+       while (<IN>) {
+               chomp;
+               s/([\%\"\'\x00-\x1f\x7f-\xff])/sprintf("%%%02X", ord($1))/eg;
+               my @spot =  split '\^';
+               my $date = cldate($spot[2]);
+               my $time = ztime($spot[2], 1);
+               print "$spot[0]\t\"$spot[1]\"\t\"$date\"\t$time\t";
+               print $spot[3] ? "\"$spot[3]\"\t" : "\t";
+               print "\"$spot[4]\"\t$spot[5]\t$spot[6]\t\"$spot[7]\"\r\n";
+       }
+       close IN;
+}
+
+
+
+