← Back to team overview

ubuntu-hams team mailing list archive

simple awk script for contest logging

 

I have been using a simple awk script for contest logging. There are 3 basic commands:
  1. "BAND 40" sets the current band to 40m.
  2. A single word  is taken as a callsign, and is searched in the ss.log file using egrep, to check for dupe, and then the exchange is prompted.
  3. A multi-word entry is taken as the exchange, and appended to the ss.log file with the current BAND, callsign, and UTC datetime.

An example usage, where I change BAND, hear KA6MAL, log the exchange, hear KG6AO but do not work him, and then hear KA6MAL again and see that I have already worked him:
$ awk -f ss.awk
BAND 40
KA6MAL
egrep: ss.log: No such file or directory
----- KA6MAL 599 CA ---------
599 CA
1 40 KA6MAL 599 CA Wed Jun  9 17:17:13 UTC 2010
KG6AO
----- KG6AO 599 CA ---------
KA6MAL
1 40 KA6MAL 599 CA Wed Jun  9 17:17:13 UTC 2010
----- KA6MAL 599 CA ---------


An example of the ss.log file:
$ tail arrldxcw/ss.log
97 20 EA4KD 599 5TT Sun Feb 21 22:11:53 UTC 2010
98 20 EF1A 599 4TT Sun Feb 21 22:14:11 UTC 2010
99 20 JA1ZGP 599 KW Sun Feb 21 22:17:48 UTC 2010
100 20 JR8VSE 599 KW Sun Feb 21 22:19:45 UTC 2010
101 20 JG2KKG 599 100 Sun Feb 21 22:20:56 UTC 2010
102 20 CT1JLZ 599 KW Sun Feb 21 22:24:01 UTC 2010
103 20 7K4QOK 599 A00 Sun Feb 21 22:28:16 UTC 2010
104 20 JA2FJP 599 KW Sun Feb 21 22:32:03 UTC 2010
105 20 JA0BJY 599 050 Sun Feb 21 22:33:15 UTC 2010
106 20 EA8CMX 599 KW Sun Feb 21 22:37:12 UTC 2010

The script that performs the logging and dupe check: 
$ more ss.awk
BEGIN{ serial = 1
    band=20}

($1 == "BAND"){band = $2;next}

# if 1 word, search log for callsign
(NF == 1){
	call = $1;
	system( "egrep " call " ss.log");
	printf( "----- %s 599 CA ---------\n", call)
	}

# if >1 word, append to log
(NF > 1){
	printf( "%s %s %s %s ", serial++, band, call, $0) >> "ss.log";
	system( "date -u >> ss.log")
	system( "tail -1 ss.log")
	}

I then use 2 more scripts to convert to Cabrillo format for contest log submission, and to ADIF for LOTW submission. I start a new directory for each contest.

This script is crude, but it evolved from an even simpler shell script which used separate directories for each band, and created a separate file for each contact. The name of each contact file was the callsign and exchange (and the file contents was empty). The file system recorded the datetime, and the "ls" command was used for dupe checking.

73, John AC6SL