Dave G wrote:
Firstly it may be that grep isn't the way to go here but ...Currently I'm downloading .loc files from Geocaching.com, converting them to .gpx format, rename them to the correct waypoint name and uploading them to the GPS, finally deleting the old .loc file (as they have a generic name - geocaching.loc)(I should mention here that I've been doing this for ages using VMWare etc. etc. but I'm keen to explore some good old "nix" options)I can do all the steps manually no worries but what I'm trying to write a bash script to automate this a bitWhat I'm wanting to do is grab a string of characters from a GPS (.loc - xml?)file and use that string to rename that file from the generic name to the specific waypoint name, convert it to .gpx & upload itI've been doing a power-of-googling tonight but I haven't got it to work yethere are the manual steps I'm currently using (which work): 1. download .loc file to /tmp2. open the .loc file and manually, copy the waypoint name then paste it into the following code (convert the Geocaching .loc file to .gpx format, then delete the .loc file):3. Code: gpsbabel -i geo -f /tmp/geocaching.loc -o gpx -F ~/<insert-Geocache-name>.gpx & rm /tmp/geocaching.loc4. finally upload the waypoint to the GPS:5. Code: gpsbabel -w -i gpx -f <insert-Geocache-name>.gpx -o garmin -F /dev/ttyS0It works quite well but isn't very elegant I'm afraid Heres a sample of a .loc file: <?xml version="1.0" encoding="UTF-8"?> <loc version="1.0" src="Groundspeak"> <waypoint><name id="GCW0FP"><![CDATA[Tasty Baking (Canterbury) by BuckoBoys]]></name><coord lat="-43.***" lon="172.***"/> <type>Geocache</type><link text="Cache Details">http://www.geocaching.com/seek/cache_details.aspx?wp=GCW0FP</link></waypoint></loc>The bit I want out is: "GCW0FP" so I end up with the file "GCW0FP.gpx" being uploaded (limited to 6 characters - numbers/letters all uppercase)Thanks in advance
Hi firstly thanks for the help & suggestionsI've got a working script now (attached) I've commented the arse out of it to (hopefully) make it obvious what I'm trying to do
I have been using it for a couple of weeks and together with some very cool web apps. especially: http://gpsvisualizer.com/;
the old "windoze-only-mapping-software-using-VMWare" is now almost redundant
I would welcome suggestions/improvements/comments- but please be gentle I'm a bit of a #bash noob .... :-)
cheers ..........dave -- cheers................Dave G Mail to: "[EMAIL PROTECTED]" ============================================== Thunderbird Mail 2.0.0.6 - Gnome 2.20.0 Ubuntu Linux 7.10- Kernel 2.6.22-14-generic ==============================================
geocache2gps.sh
Description: application/shellscript
