Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- ####################
- # combineloc.sh by The Lightning Stalker 2008
- # 10/21/2017 - Updated for newer versions of `test`
- #
- # Script to combine GPS .loc files in the current directory into one file
- # Works only for xml formatted .loc files 8 lines long.
- #
- # j is going to be set for our first iteration in which we print out the
- # header. Subsequent iterations print the data lines stripped from each .loc
- # file. Then the trailing </loc> is printed before EOF.
- ####################
- j=1
- for i in *.loc; do
- if test "x$j" != "x" ; then
- echo '<?xml version="1.0" encoding="UTF-8"?>'
- echo '<loc version="1.0" src="Groundspeak">'
- echo
- unset j
- # continue
- fi
- if test `wc -l "$i" | awk '{print $1}'` -eq "8" ; then
- echo '<waypoint>'
- tail -n6 "$i" | head -n5
- echo '</waypoint>'
- fi
- done
- echo
- echo '</loc>'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement