A script to generate the satellites from LoTW

1 post / 0 new
N9KT
A script to generate the satellites from LoTW

Saku made a shell script to do this a long time ago, but it stopped working because of changes in the LoTW page format. So, I redid it with comments to make it easier to change if the LoTW page changes again. I put my script in a file so I could easily run it whenever I needed. Here are the steps:

1. Create a file in your home directory with the following in it (I called mine update-cqrlog-sat-names.sh):

#!/bin/bash
# Make backup of sat_name.tab
mv -f ~/.config/cqrlog/sat_name.tab ~/.config/cqrlog/sat_name.tab.bak;
# Get ARRL web page and put into /tmp/hi
wget -q -O- https://lotw.arrl.org/lotw-help/frequently-asked-questions/#sats | html2text > /tmp/hi;
# Calculate how many lines from **Name** to end of file
lines=$((($(wc /tmp/hi | awk '{print$1}')-$(grep -n " **Name**" /tmp/hi |awk -F: '{print$1}'))));
# Remove miscellaneous lines at the end of the file and format for CQRLOG
tail -n $lines /tmp/hi | head -n $(( $lines - 6 )) | sed 's/ \+/\|/' > ~/.config/cqrlog/sat_name.tab;
# Delete temporary file
rm /tmp/hi

2. Make the script executable:
chmod u+x update-cqrlog-sat-names.sh

3. Run it:
./update-cqrlog-sat-names.sh

If anything goes wrong, the script makes a backup of your original file and calls it: ~/.config/cqrlog/sat_name.tab.bak
You can move that back into place with:
mv -f ~/.config/cqrlog/sat_name.tab.bak ~/.config/cqrlog/sat_name.tab

One other note, if you edit ~/.config/cqrlog/sat_name.tab and move your most used satellites to the top of the file, they will appear first in the drop-down list.

-David, N9KT