convert wsjt.log to adif format (Perl)

 

Perhaps missing the point šŸ˜‰ – but I still use the log function in WSJT-10 and it logs into this CSV format. Short snip to convert to ADIF. You need to change some of the fields to reflect the QRG + LOC + Station call. Note the number in the field “TF3T” – is the character count of the callsign, and must match.

#!/usr/bin/perl

# convert WSJT.LOG -> ADIF
# TF3T 2017101600


use strict;
use warnings;
my %MONTH_NUMBER = (
    'Jan' => 1,
    'Feb' => 2,
    'Mar' => 3,
    'Apr' => 4,
    'May' => 5,
    'Jun' => 6,
    'Jul' => 7,
    'Aug' => 8,
    'Sep' => 9,
    'Oct' => 10,
    'Nov' => 11,
    'Dec' => 12,    
);

my $month = 0 ; 
my $file = $ARGV[0] or die "Need the WSJT.log as argument \n";
 
my $sum = 0;
open(my $data, '<', $file) or die "Could not open '$file' $!\n";
 
while (my $line = <$data>) {
  chomp $line;
  my @fields = split "," , $line;
  
  $month  = $MONTH_NUMBER{ substr($fields[0], 5, 3) };
  my $year  = substr($fields[0], 0, 4);
  my $day   = substr($fields[0], 9, 2);
  my $month = sprintf("%02d", $month);

  my $call	= $fields[2];
  my $call_l	= length($call);
  
  my $date 	= "$year$month$day";  
  my $date_l	= length($date);

  my $qrg 	= $fields[4];
  my $qrg_l	= length($qrg);

  my $mode	= $fields[5];
  my $mode_l	= length($mode);

  my $hours 	= substr($fields[1],0,2);
  my $minutes = substr($fields[1],3,2);
  my $time = "$hours$minutes";

  my $time_l	= length($time);

print <<FLE
<CALL:$call_l>$call
<QSO_DATE:$date_l>$date
<TIME_ON:$time_l>$time
<TIME_OFF:$time_l>$time
<FREQ_RX:7>144.250
<FREQ:7>144.250
<BAND:2>2m
<BAND_RX:2>2M
<MODE:4>JT65
<RST_SENT:1>O
<RST_RCVD:1>O
<MY_GRIDSQUARE:6>HP94AD
<OPERATOR:4>TF3T
<MY_RIG:11>Elecraft K3
<EOR>

FLE
}