X-Git-Url: http://gb7djk.dxcluster.net/gitweb/gitweb.cgi?a=blobdiff_plain;f=perl%2Fspot2csv.pl;fp=perl%2Fspot2csv.pl;h=100a8d3a2320be084fa61849808d66488a56163a;hb=3298d47dabb1251d9906aca6b5158b405f29383f;hp=0000000000000000000000000000000000000000;hpb=09f90105aa04bc675d50b42fa59013a8291696b0;p=spider.git diff --git a/perl/spot2csv.pl b/perl/spot2csv.pl new file mode 100755 index 00000000..100a8d3a --- /dev/null +++ b/perl/spot2csv.pl @@ -0,0 +1,39 @@ +#!/usr/bin/perl -w +# +# convert a DXSpider Spot file to csv format +# +# usage: spot2csv.pl ... +# +# 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 ....\n" unless @ARGV; + +for (@ARGV) { + unless (open IN, $_) { + print STDERR "cannot open $_ $!\n"; + next; + } + while () { + 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; +} + + + +