PE1AQP's WSJTX-Log to Cabrillo-file Conversion.

Table of Contents


Introduction

Several ham-radio contests require the participants to submit their results in the Cabrillo file format. See for some descriptions of this file format the following web-sites:

To take part in digital contests, like the PACCdigi, one almost certainly uses a program like WSJTx or JTDX. These programs maintain their own log file for all completed (digital) QSOs.

These WSJTX log files and the Cabrillo submission file format are both simple, text-only, line-orientated file formats. Conversion from one into the other is therefore good to do with standard "on board" Unix (Linux, BSD, Mac-OS, etc.) tools. I describe below my conversion procedure based on Awk, Make and some plain text editor (for which I use (of course) Emacs, but any other will do as well).

At the end of the page is a download link to get a copy of the relevant sources. You (the reader of this page) could use these as starting-point for your own conversions.


First step, get the log file

For the PACCdigi 2021, I used the JTDX program. This program stores its QSO log in the file $(HOME)/.local/shared/JTDX/wsjtx.log. This path might be different on other computers, operating systems or when using different programs.

Get a copy of this file (so errors in the following steps don't cause any data loss). Edit this copy with a plain text editor and select all lines that are related to the contest; remove all others. Store that selection in the file mod-wsjtx.log.


The Cabrillo File Header

The next step is to create and adjust (with a plain text-editor) the Cabrillo file header to fit the requirements of the contest and to show your station information.

My dk1aqp-cabheader.txt for the PACCdigi 2021 looks (more or less) as follow:

START-OF-LOG: 3.0
LOCATION: DX
CALLSIGN: DK1AQP
CLUB:
CONTEST: PACCDIGI
CATEGORY-OPERATOR: SINGLE-OP
CATEGORY-ASSISTED: ASSISTED
CATEGORY-BAND: ALL
CATEGORY-MODE: DIGI
CATEGORY-POWER: LOW
CATEGORY-STATION: FIXED
CATEGORY-TRANSMITTER: ONE
CLAIMED-SCORE:
OPERATORS: DK1AQP
NAME: dummy
ADDRESS: dummy
ADDRESS-CITY: dummy
ADDRESS-STATE-PROVINCE:
ADDRESS-POSTALCODE: dummy
ADDRESS-COUNTRY: dummy
EMAIL: your.address@example.com
SOAPBOX: Great contest !

This header file can be download (see below), to be used as starting-point for a following contest.


The AWK script

The (not so very) "heavy lifting" of the conversion is done by this Awk script:

# wsjtx2cabrillo.awk

BEGIN{
    FS="[,:]";
    print "CREATED-BY: wsjtx2cabrillo.awk V1 (by pe1aqp/dk1aqp)";
}
END { print "END-OF-LOG:";}
/^[ \t]*\#/ { next; }                  # Drop comment lines
{
    printf("QSO:")
    printf("%6d",  1000.0 * $11 );     # QRG Frequency/kHz
    printf(" DG ");                    # Fixed for wsjt etc. :-)
    printf("%10s ",  $5);              # Date (ISO-8601, UTC)
    printf("%2s%2s", $6,$7);           # Time (UTC)
    printf(" %-11s ",toupper(MYCALL)); # My call
    printf("%5s ",   $13);             # Report send
    printf("%5s ",   toupper(MYQTH));  # My Locator
    printf("%-11s ", toupper($9));     # Remote call
    printf(" %6s ",  $14);             # Report received
    printf("%5s",    toupper($10));    # Remote locator        
    printf("\n");
}

The Makefile

I like to pull all this together with make. Adjust the MYCALL and MYQTH variables in this makefile to fit your station.

# Makefile 

MYCALL=dk1aqp
MYQTH=JO30

HDRFILE=$(MYCALL)-cabheader.txt
TGTFILE=$(MYCALL).cab

default:$(TGTFILE)

$(TGTFILE): mod-wsjtx.log wsjtx2cabrillo.awk  $(HDRFILE) Makefile
	-@(test -f $(HDRFILE) && grep -ve '^[ \t]*#'  $(HDRFILE) ) > $(TGTFILE)
	@awk -v MYCALL=$(MYCALL) -v MYQTH=$(MYQTH) -f wsjtx2cabrillo.awk mod-wsjtx.log >> $(TGTFILE)
	@cat $(TGTFILE)

$(HDRFILE):
	@echo '****' You should create a cabrillo header file named $(HDRFILE)

cl:clean
clean: FORCE
	rm -rf *~ $(TGTFILE)

FORCE:
.PHONY: default FORCE clean cl

Running this with the default target (i.e.: simply typing make) will create the cabrillo file dk1aqp.cab, or a file with whatever name you provided in the MYCALL variable in your copy of the makefile.


Download

The Makefile, Awk script, Cabrillo header file and an example mod-wsjtx.log file can be downloaded here: wsjtx2cabrillo.tgz. (This is a compressed tar (tgz) archive.)


Contact information

You can contact me at the email-address: <My dutch or german callsign> AT veron.nl.


Back to

The Fine Print

I'm a fan of the GPL, and in particular the GPLv3, license. But the code presented here is too small for such a license; it is therefore explicitly put in the public domain. More accurately:

Author: Jon Krom : See Colophon

Created: 2021-04-20 Tue 14:42

Emacs 25.1.1 (Org mode 8.2.10)

Validate