Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- cat << EOF
- <?xml version="1.0" encoding="UTF-8"?>
- <gpx 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">
- <trk>
- <name>pojmenuj</name>
- <trkseg>
- EOF
- stringMin="-"
- stringT="T"
- stringColon=":"
- stringZ="Z"
- while read line
- do
- timestampHarsh=`echo "$line" | cut -d "," -f 1`
- timestampNice=`echo "$timestampHarsh" | cut -d ":" -f 2 | cut -d "." -f1 | tr -d '[[:space:]]'`
- rok=${timestampNice:0:4}
- mesic=${timestampNice:5:1}
- den=${timestampNice:6:2}
- hod=${timestampNice:8:2}
- min=${timestampNice:10:2}
- sec=${timestampNice:12:2}
- timestamp=$rok$stringMin$mesic$stringMin$den$stringT$hod$stringColon$min$stringColon$sec$stringZ
- lat=`echo "$line" | cut -d "," -f 2`
- lon=`echo "$line" | cut -d "," -f 3`
- echo "<trkpt lat=\"$lat\" lon=\"$lon\">"
- echo "<time>$timestamp</time>"
- echo "</trkpt>"
- #moje_csv.csv je hned vedle tohoto scriptu
- done < moje_csv.csv
- cat << EOF
- </trkseg>
- </trk>
- </gpx>
- EOF
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement