#
# PURPOSE: Create Matlab-readable file of the avu location and time-stamps from
#	   the Winfrog log file.
# AUTHOR:  Rob McEwen
# DATE:    00/6/8
#
# NOTES:1) See page B-7 of the Winfrog User's Guide for the format description.

 if [ $1 ]
 then
   echo "Converting USBL data ..."
 else
   echo "cvtwfq: Please furnish a file name."
   exit -1
 fi

 echo "usbl = [ ... " > dataUsbl.m
 cat $1 | cut -f 6,7,11,12,13,26,27,28,29,30,31,32,33 -d "," >> dataUsbl.m
 echo " ];" >> dataUsbl.m

 cat $1 | cut -f 2 -d "," | cut -f 2 -d " " > temp.txt
#
# This gnarly sed command inserts a ' at the start and end of each line.
#
 cat temp.txt | sed 's/^/'\''/' | sed 's/$/'\''/' > temp1.txt


 echo "usblTime = [ ... " > dataUsblTime.m
 cat temp1.txt >> dataUsblTime.m
 echo " ];" >> dataUsblTime.m

 rm temp.txt
 rm temp1.txt


