X-Git-Url: http://dxcluster.net/gitweb/gitweb.cgi?a=blobdiff_plain;f=perl%2Fexport_opernam.pl;fp=perl%2Fexport_opernam.pl;h=2107c1aa57878e6b2046882114c6cbec654414a6;hb=28b2bbdfbc91fc224d33cc53d122190974ca0b75;hp=0000000000000000000000000000000000000000;hpb=2c893f2c512246c411c969a5634a003b687cd04c;p=spider.git diff --git a/perl/export_opernam.pl b/perl/export_opernam.pl new file mode 100755 index 00000000..2107c1aa --- /dev/null +++ b/perl/export_opernam.pl @@ -0,0 +1,32 @@ +#!/usr/bin/perl +# +# export a standard ak1a opernam.dat file into CSV format. +# +# Copyright (c) 1999 Dirk Koopman G1TLH +# +# + +sub export +{ + my $rec = shift; + my @f = unpack "SA13A23SA12A6SSSSA1CSSSA1A80A1A13A1", $rec; + my $f; + + # clean each field + for $f (@f) { + my @a = split m{\0}, $f; + $f = $a[0] if @a > 1; + } + + print join '|', @f; + print "\n"; +} + +die "Need an filename" unless @ARGV; +open IN, $ARGV[0] or die "can't open $ARGV[0] ($!)"; + +while (sysread(IN, $buf, 196)) { + export($buf); +} +close IN; +exit(0);