android-locdump
android-locdump copied to clipboard
Easy way to merge cache.cell and cache.wifi ?
It would be nice to have a way to merge both formats, particularly when using the gpx output format.
What I've been doing (below) is sort of a drag :)
( python android-locdump/parse.py --gpx cache.wifi ; python android-locdump/parse.py --gpx cache.cell ) >gpxes.$$; num='[0-9][0-9]*'; cat gpxes.$$ | grep '^<trkpt.*</trkpt>$' | sed "s/<time>\($num\)-\($num\)-\($num\)T\($num\):\($num\):\($num\)\.\($num\)*Z<\/time>/#\1\2\3\4\5\6\7#/" | sort -t '#' -k 2 -n | sed "s/#\(....\)\(..\)\(..\)\(..\)\(..\)\(..\)\($num\)#/<time>\1-\2-\3T\4:\5:\6.\7Z<\/time>/" >trkpts.$$ ; n_trkpts=`wc -l <trkpts.$$`; ( head -4 gpxes.$$ | sed 's/total: [0-9][0-9]*'/"total: $n_trkpts/" ; cat trkpts.$$ ; tail -1 gpxes.$$ ; rm -f trkpts.$$ gpxes.$$ ) >both.gpx
(in my case, followed by gpsbabel -i gpx -f both.gpx -o kml -F both.kml)... In any event thanks! Good stuff!
That's one impressive command line :)
It's of course possible to change it to handle multiple files. I'm not gonna spend time on it though, however if you change it I'll happily merge the changes.