BEGIN { FS=" "; printf("Waypoints hddd°mm'ss.s\" WGS-84\n"); printf(" Breite"); printf(" Länge Time Symbol Alt\n"); x=0; } { # Process only lines with coordinates if($8!="") { x=x+1; # Take time as waypoint name gsub(":","",$1); printf("%02d%-4.4s ",x%100,$1); # Take two or three fields as description if($3=="-") { printf("%-26.26s ",$4 " " $5); } else { printf("%-26.26s ",$3 " " $4 " " $5); } # Calculate coordinates lon=substr($8,2,6); long=lon/10000; lonm=(lon/100)%100; lons=lon%100; lat=substr($8,9,6); latg=lat/10000; latm=(lat/100)%100; lats=lat%100; # Write coordinates printf("N %02ld°%02ld'%02ld.0 ",latg,latm,lats); printf("E%03ld°%02ld'%02ld.0 ",long,lonm,lons); # Finish line printf(" 0 12 \n"); } }