Skip to content

Instantly share code, notes, and snippets.

@PanJarda
Last active December 15, 2018 22:47
Show Gist options
  • Save PanJarda/9f6c6b49247a6132cc4c2ab70082302f to your computer and use it in GitHub Desktop.
Save PanJarda/9f6c6b49247a6132cc4c2ab70082302f to your computer and use it in GitHub Desktop.
#!/usr/bin/awk -f
# transforms txt into gpx format
BEGIN {
print "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<gpx creator=\"jardacardapetarda\" version=\"1.1\" xmlns=\"http://www.topografix.com/GPX/1/1\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd\">\n <trk>\n <name></name>\n <trkseg>"
}
/^[0-9]/ {
print "<trkpt lat=\"" $1 "\" lon=\"" $2 "\"></trkpt>"
}
END {
print "</trkseg>\n</trk>\n</gpx>"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment