Already come a cropper, hoist by my own petard, etc etc
I put a warning in my code that its a hack and I’ve already seen its limitation. Basically, I really need to re-write it getting to grips with the xml and not just hacking away at the file as if it’s just a set of strings. [LATER EDIT: please don’t use this script – see here for an improved version] After trying to name a gpx file that was produced in a different way to my normal ones (normal = from a Garmin etrex, read through GPSbabel. Different = from a Qstarz Datalogger, read through BT-747), I found myself having to use the albeit brilliant xml parser I seem to have built into this Ubuntu box (see Validate GPX file in Linux here) and manually check the tags on a huge file.
Still, Soph is currently doing a lot of unpicking of her new knitting, so I feel pretty on a par.