awkpullgprmc: BEGIN { FS = "," } { FS = "," if ($1=="$GPRMC") { print $0 } endif }
awk_justgprmc: BEGIN { FS="," } { FS= "," ARGC = 2 if ($1=="$GPRMC") { gpstime = $2 hr = substr($2,1,2) min = substr($2,3,2) sec = substr($2,5,2) latdeg = substr($4,1,2) latmin = substr($4,3,6) londeg = substr($6,2,2) lonmin = substr($6,4,6) declat = latdeg + (latmin/60) declon = (londeg + (lonmin/60)) * -1 date = $10 day = substr($10,1,2) month = substr($10,3,2) year = substr($10,5,2) printf("%8.6f, %8.6f, %s:%s:%s, %s\n",declon, declat, hr, min, sec, date) } }
awknav: { shipdate = $1 gpstime = $2 latdeg = substr($5,1,2) latdecmin = $6 declat = latdeg + (latdecmin/60) londeg = substr($7,1,3) londecmin = $8 declon = -1 * (londeg + (londecmin/60)) depmeters = $10 printf("%s, %s, %9.6f, %9.6f, %s\n",shipdate, gpstime, declat, declon, depmeters) }
awk_sddpt: { depthval = $1 printf("$SDDPT,%s,0.0*65\n",depthval) }
AWK script awkit: BEGIN { FS="," } { FS= "," ARGC = 2 if ($1=="$GPRMC") { gpstime = $2 hr = substr($2,1,2) min = substr($2,3,2) sec = substr($2,5,2) latdeg = substr($4,1,2) latmin = substr($4,3,6) londeg = substr($6,2,2) lonmin = substr($6,4,6) declat = latdeg + (latmin/60) declon = (londeg + (lonmin/60)) * -1 date = $10 day = substr($10,1,2) month = substr($10,3,2) year = substr($10,5,2) } else if ($1=="$SDDPT") { depth = $2 printf("%8.6f, %8.6f, %s:%s:%s, %s, %s, %s\n",declon, declat, hr, min, sec, date, depth, ARGV[2]) } }The running of the script was initiated with a simple executable shell script under CYGWIN (a Unix like environment that runs under Windows
"doawk": files=`ls *.gps | cut -d. -f1` for file in $files do awk -f awkit $file.gps $file >> resnav_jd249.txt done
schema.ini: [resnav_jd249.txt] Format=CSVDelimited ColNameHeader=True Col1=longitude Double Col2=latitude Double Col3=gpstime Text Width 8 Col4=gpsdate Text Width 10 Col5=depth_m float Col6=linename Text Width 11