Compare commits

..

No commits in common. "b2ad8854df4d12cafbdadb239893457f8cbfdae3" and "953b0904c06ed381af65dbe90bd8c74a71a788c0" have entirely different histories.

3 changed files with 2 additions and 76 deletions

View file

@ -1,2 +1 @@
"THE BEER-WARE LICENSE" (Revision 42): "THE BEER-WARE LICENSE" (Revision 42): <phk@FreeBSD.ORG> wrote this file. As long as you retain this notice you can do whatever you want with this stuff. If we meet some day, and you think this stuff is worth it, you can buy me a beer in return Poul-Henning Kamp
Wolfgang Kroener wrote this. As long as you retain this notice you can do whatever you want with this stuff. If we meet some day, and you think this stuff is worth it, you can buy me a beer in return.

View file

@ -1,11 +1,3 @@
# adif-pota2sig # adif-pota2sig
Convert POTA fields in adif files to SIG and SIG_INFO fields Convert POTA fields in adif files to SIG and SIG_INFO fields
Parse adif file, if a record has one or more POTA_REF entries (delimited by a
comma), add SIG POTA and SIG_INFO with reference. Multiply record such, that
every POTA_REF entry is a separate record with own SIG_INFO.
Extended adif file will be printed to stdout.
Usage:
adif-pota2sig.pl logfile.adi > extended-logfile.adi

View file

@ -1,65 +0,0 @@
#!/usr/bin/env perl
#
# SPDX-License-Identifier: Beerware
# Wolfgang DM5WK Kroener wrote this file. As long as you retain this notice you
# can do whatever you want with this stuff. If we meet some day, and you think
# this stuff is worth it, you can buy me a beer in return.
#
# modified from perlmonks - TedPride - http://www.perlmonks.org/?node_id=559222
# modified from https://scruss.com/blog/2011/05/23/parsing-adif-with-perl/
#
# Description:
# Parse adif file, if a contact has one or more POTA_REF entries (delimited by
# a comma), add SIG POTA and SIG_INFO with reference. Multiply contact such,
# that every POTA_REF entry is a separate contact with own SIG_INFO.
# Extendet adif file will be printed to stdout.
#
# Usage:
# adif-pota2sig.pl logfile.adi > new-logfile.adi
use strict;
use warnings;
# use filename.adi as parameter
open(my $FH, '<', $ARGV[0]) or die "$ARGV[0]: $!";
while (<$FH>) {
print;
# fast forward past header
last if m/<EOH>\s+$/i;
}
my @entry = ();
my @pota_refs = ();
while (<$FH>) {
push @entry, $_;
if (m/<EOR>\s+$/i) {
# entry complete
if (scalar(@pota_refs) > 0) {
# add sig_info to each pota reference
foreach my $ref (@pota_refs) {
# print all except last
print @entry[0 .. $#entry - 1];
# insert POTA SIG
print "<SIG:4>POTA\n";
print "<SIG_INFO:" . length($ref) . ">" . $ref . "\n";
# print last
print $entry[-1];
}
} else {
# no park reference in this entry
print @entry;
}
# clear entry and pota refs for next entry
@entry = ();
@pota_refs = ();
} elsif (m/^<POTA_REF:/) {
# get last element of split >
my $val = (split(/>/))[-1];
chomp($val);
# fill pota_refs with references
@pota_refs = split(/,/, $val);
chomp @pota_refs;
}
}
close($FH);