#!/bin/bash # Convert Direwolf decode of RamSat 9k6 packets (containing ASCII) to JPG image file # # !!! IMPORTANT - see notes at bottom of file to adjust this to work with the format of your direwolf output # if [ $# -eq 0 ]; then echo -e "\n" echo "!!! Syntax: " $0 " {name_of_direwolf_decode_file} " echo -e "\n" exit 1 fi cat $1 |grep RS|grep -v 010:|grep -v RSBeac| cut -c 9-| tr -d "\n" | tr -d "\r"| sed 's/\.*00*$//' | xxd -r -p > $1.jpg echo -e "\n" echo "... saved file " $1".jpg" echo -e "\n" echo -e "\n" # Explanation of command: # # cat $1 >> stream contents of filename given on command line after script name (i.e., ./ramsat-image-decode.sh direwolf-capture.txt) # # |grep RS|grep -v 010:|grep -v RSBeac| >> extract only lines of file that contain the desired decoded characters # # | cut -c 47- >> remove the first 47 characters from each line *** NOTE - this count MUST be adjusted depending on the format of your direwolf decode files. # *** NOTE: count changed to '9' to match spacing in 'CMD1_001.txt' sample file provided by RamSat team # # >> Example from mine: [2021-08-15 21:00:54] [0.4] CQ>W4SKH:RS: 579 AFAD47275A621EB4E6A40 # >> If you do not time-stamp, etc., count # of spaces up to first HEX bytes ("AFAD", in above example) & change 'cut -c 47-' to fit your count # # | tr -d "\n" | tr -d "\r" >> remove carriage return and/or line feed from end of each line from the decode file # # | sed 's/\.*00*$//' >> the last packet will probably have some zeroes after the final 'FFD9' characters. This removes those zeroes # # | xxd -r -p > $1.jpg >> convert the resulting string of ASCII characters from the direwolf decode to hex & save as JPG file w/ same name as input file #