Good afternoon guys,

sorry for the delay. The weather and work have been conspiring against
me to actually getting much done besides work and chores around home.

attached you will find two files:

tlf2cab_notes.txt and tlf2cab.txt

The notes file is just that, short and sweet notes on how to use this
perl script.

tlf2cab.txt is the perl script. Copy or place where you want to use it
and rename it to tlf2cab.pl  

I sent the script as txt file as some virus scanning and firewalls
intercept and remove scripts. 

You will have to edit the script to add your one information. I have
edited out my information and put in descriptive generic text.

Remember, this is a very simple perl script and was a quick and dirty
tool to get the job done. I will be adding to it as my needs dictate and
if others find it useful I will continue to update the archive and I
will look for updates and suggestions from others. 

cheers, Graham ve3gtc



On Mon, 2012-01-16 at 17:09 +0100, Thomas Beierlein wrote:
> Hi Graham,
> 
> 
> Am Sun, 15 Jan 2012 21:47:11 +0000
> schrieb Graham <planoph...@aei.ca>:
> > Thanks Tom.
> > 
> > copied, installed, built and working OK.
> > 
> good to hear :-).
> 
> > I used TLF in this weekends North American QSO Party. TLF does not
> > export a nice cabrillo format file for this contest. The exchange was
> > name and state/province or country. TLF truncates received exchange.
> 
> Well that code is really old and dates back to the first years of
> using cabrillo format. It supports only the ARRL standard contests. In
> menatime some other formats of the QSO lines got added to the standard,
> but not to tlf :-(.
> 
> > I had intended to dig into the part of TLF which does the cabrillo
> > format creation but just haven't gotten around to it. So, I wrote a
> > simple perl script called tlf2cab.pl to convert the TLF log format to
> > cabrillo.
> 
> Very well. I think that may be the best way for postprocessing the log
> file - to use some external programs. They can be written in ohter
> languages as C and are more easily extensible.
> 
> > I can share the script with anyone who wants it or we can place on the
> > tlf archive someplace.
> 
> That would be very nice. As a first idea - put it on
> tlf.wikispaces.com. Better yet, send it to me and I will add it as user
> contributed script to the distribution.
> 
> > Cabrillo is a standard but version 2 and version 3 are both commonly
> > used plus it seems as every contest has their variation on exchanges
> > and how the details need to be put in the cabrillo log file. 
> 
> See http://www.kkn.net/~trey/Cabrillo_v2/qso-template.html for the
> official supported formats. Other ones may be also around.
> 
> > I am very comfortable working in a terminal with command lines and
> > scripts. I see the task of exporting the tlf log into cabrillo as a
> > job for a script. Others are not so comfortable and like the ability
> > built into the application. 
> 
> If needed we could make tlf's ':wri' command to call that external
> script. That would drop the command line barrier for others.
> 
> > For now I will use and update my script but will also give some more
> > thought to what is needed in tlf to do the same thing.
> > 
> You can find the code for writing the header in src/getsummary.c. The
> real code for writing the QSO lines are in src/writecabrillo.c. It is
> not written nice and I am working a little bit on it. Any
> help and suggestions for improvements are welcome.
> 
> 73 for now,
>       Tom DL1JBE.
> 
> 
> 

tlf2cab_notes.txt

2012-01-22 - GTC

simple perl script to convert tlf log file to cabrillo format

currently outputs cabrillo v2 format

does no score computing

use: (for example)

$cat /home/ve3gtc/tlf/naqp/naqp.log | /home/ve3gtc/scripts/./tlf2cab > [out 
cabrillo file name]


or, if run from tlf log folder

$cat naqp.log | /home/ve3gtc/scripts/./tlf2cab > [out cabrillo file name]


#!/usr/bin/perl
# 
# tlf2cab.pl - simple perl script to convert TLF log file to cabrillo log format
#
# use: $ cat <logfile> | ./tlf2cab.pl > <outfile>
#
# version 0.0.1 2012-01-15 - VE3GTC
#   - does no score computing
#   - to do: add simple help and make more universal to start with
#
#-----------------------------------------------------------------------------------------------------
#
# Cabrillo version 2.0 log format example (single op):
#
# START-OF-LOG: 2.0
# CALLSIGN: WA7BNM
# CATEGORY: SINGLE-OP ALL LOW
# CLAIMED-SCORE: 9
# CLUB:
# CONTEST: NAQP-SSB
# CREATED-BY: TR Log POST Version 6.67
# NAME: Bruce Horn
# ADDRESS: 4225 Farmdale Avenue
# ADDRESS: Studio City, CA 91604
# OPERATORS: WA7BNM
# SOAPBOX:
# QSO: 28300 PH 2003-01-18 1805 WA7BNM          BRUCE      CA  XE2MX           
LOCO       XE
# QSO: 28300 PH 2003-01-18 1806 WA7BNM          BRUCE      CA  NA4W            
CORT       AL
# QSO: 28300 PH 2003-01-18 1807 WA7BNM          BRUCE      CA  W9RE            
MIKE       IN
# END-OF-LOG:
#
#---------------------------------------------------------------------------------------------------
#
# TLF log format
#
# 10CW  14-Jan-12 18:42 0001  N7QQ           599  599  REX WA                 1 
# 10SSB 14-Jan-12 18:42 0001  N7QQ           599  599  REX WA                 1 
#---------------------------------------------------------------------------------------------------
#
use strict;  
use warnings;
use Switch;

my $mode               ;
my $cabrilloRecord     ;
my $contest = "NAQP"   ;
my $myCall  = "MYCALL" ;
my $myName  = "MYNAME" ;
my $myQTH   = "MYQTH"     ;

#
# print out header for log - very simple at this point
#
print "START-OF-LOG: 2.0\n"                     ;
print "CALLSIGN: MYCALL\n"                      ;
print "CATEGORY: SINGLE-OP ALL QRP\n"           ;
print "CLAIMED-Score: \n"                       ;
print "CLUB: MYCLUB\n"            ;
print "CONTEST: NAQP-CW\n"                      ;
print "CREATED-BY: perl script tlf2cab v0.1\n"  ;
print "NAME: My Name\n"                  ;
print "ADDRESS: MYADDRESS1\n"                      ;
print "ADDRESS: MYADDRESS2\n"              ;
print "ADDRESS: MYADDRESS3\n"               ;
print "OPERATORS: MYCALL\n"                     ;
print "SOAPBOX: \n"                             ;

#
# process input log file
#
while (<STDIN>) {

        chomp;

        my ($band, $date, $time, $number, $Call, $sentRST, $rcvdRST, $Name, 
$QTH, $points) = split(' ', $_);

        #
        # reformat band and mode for cabrillo record
        #
        switch ($band) {
                case "10CW"   { $band = "28000", $mode = "CW";  }
                case "10SSB"  { $band = "28000", $mode = "PH";  }

                case "15CW"   { $band = "21000", $mode = "CW";  }
                case "15SSB"  { $band = "21000", $mode = "PH";  }

                case "20CW"   { $band = "14000", $mode = "CW";  }
                case "20SSB"  { $band = "14000", $mode = "PH";  }

                case "40CW"   { $band = " 7000", $mode = "CW";  }
                case "40SSB"  { $band = " 7000", $mode = "PH";  }

                case "80CW"   { $band = " 3500", $mode = "CW";  }
                case "80SSB"  { $band = " 3500", $mode = "PH";  }

                case "160CW"  { $band = " 1800", $mode = "CW";  }
                case "160SSB" { $band = " 1800", $mode = "PH";  }

                else          { $band = "unknown band or mode", $mode = "XX"; }
                }

        #
        # reformat date for cabrillo record
        #
        my ($day, $month, $year) = split('-', $date);

        switch (uc($month)) {
                case "JAN" { $month = "01"; }
                case "FEB" { $month = "02"; }
                case "MAR" { $month = "03"; }
                case "APR" { $month = "04"; }
                case "MAY" { $month = "05"; }
                case "JUN" { $month = "06"; }
                case "JUL" { $month = "07"; }
                case "AUG" { $month = "08"; }
                case "SEP" { $month = "09"; }
                case "OCT" { $month = "10"; }
                case "NOV" { $month = "11"; }
                case "DEC" { $month = "12"; }
                else       { $month = "unknown month"; }
                }

        $date = "20".$year."-".$month."-".$day;

        #
        # formate time for cabrillo record
        #
        my ($hour, $minute) = split (':', $time);

        $time = $hour . $minute;

        #
        # put all the bits in their proper place and pad with spaces to the 
required field length
        #

        switch (uc($contest)) {
                
                case "NAQP"     {
                                # QSO Contents:
                                #                              ----------info 
sent----------- ----------info rcvd----------- 
                                # QSO: freq  mo date       time call            
name       qth call            name       qth t
                                # QSO: ***** ** yyyy-mm-dd nnnn *************** 
aaaaaaaaaa aaa *************** aaaaaaaaaa aaa n
                                # QSO: 14042 CW 1999-09-05 0000 N5TJ            
JEFF       TX  N6TR            TREE       OR
                                # 
000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999
                                # 
123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123
                                # Example single-op QSO entries:
                                # QSO:  3500 CW 2003-01-12 0541 WA7BNM          
BRUCE      CA  K6ZZ            BOB        CA
                                # QSO: 14150 PH 2003-01-18 2120 WA7BNM          
BRUCE      CA  K6RO            LARRY      CA
                                # QSO: 28050 RT 2003-02-22 1834 WA7BNM          
BRUCE      CA  K7WM            WAYNE      AZ
                                #
                                # Example multi-two QSO entries:
                                # QSO: 28000 CW 2003-01-11 1803 N5TJ            
JEFF       TX  K6ZZ            BOB        CA  0
                                # QSO: 21000 CW 2003-01-11 1803 N5TJ            
JEFF       TX  WA7BNM          BRUCE      CA  1
                                # QSO: 21000 CW 2003-01-11 1804 N5TJ            
JEFF       TX  N6TR            TREE       OR  1
                                #
                                # create cabrillo record
                                #
                                $cabrilloRecord = "QSO: ";
                                $cabrilloRecord = $cabrilloRecord . $band       
          . " "  ;
                                $cabrilloRecord = $cabrilloRecord . $mode       
          . " "  ;
                                $cabrilloRecord = $cabrilloRecord . $date       
          . " "  ;
                                $cabrilloRecord = $cabrilloRecord . $time       
          . " "  ;
                                $cabrilloRecord = $cabrilloRecord . pack( 
'A15', $myCall) . " "  ;
                                $cabrilloRecord = $cabrilloRecord . pack( 
'A10', $myName) . " "  ;
                                $cabrilloRecord = $cabrilloRecord . pack( 'A3' 
, $myQTH)  . " "  ;
                                $cabrilloRecord = $cabrilloRecord . pack( 
'A15', $Call)   . " "  ;
                                $cabrilloRecord = $cabrilloRecord . pack( 
'A10', $Name)   . " "  ;
                                $cabrilloRecord = $cabrilloRecord . pack( 'A3', 
 $QTH)    . " "  ;
                                }

                else { print "unknown contest \n"; }
                }

        print "$cabrilloRecord\n";

}

print "END-OF-LOG:\n";

exit 0;

_______________________________________________
Tlf-devel mailing list
Tlf-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tlf-devel

Reply via email to