A few days ago I went for a ride, around 50km, and had all my Garmin products running – including heart rate monitor and cadence sensor.

The Garmin heart rate monitor started to produce some very weird numbers during my ride. Lets just say that my heart rate has never come close to 263bpm.

I did however want to upload the data to my favourite site, Strava.

This is what I did to amend my data.

Step 1 – upload the ride as per normal

Step 2 – download the GPX file of the activitiy

Step 3 – amend the GPX file

Now that you have done this much, here’s where it will get a little tricky. The GPX file is really a XML file that has all your data inside of it. The file has a lot of data points and doing this manually will be a nightmare. So, this is where you need to be a little crafty with your file. For me, I wanted to remove all the heart rate data from the file – as it was all incorrect.

Here are the commands that I used to remove the lines. Keep in mind that you can do this for any data items inside of the file. This is for a Mac.

Open up terminal and type the following;

sed “/<gpxtpx:hr>.*</gpxtpx:hr>/d” ~/Downloads/Went sightseeing.gpx > tmp.txt

Allow me to break down the command above so that you can use it for yourself. The “/<gpxtpx:hr>.*</gpxtpx:hr>/d” is text that I want to search for, in my case, the heart rate. Next is the location of the file and filename “~/Downloads/Went sightseeing.gpx”. Again, point it to your specific file path and filename.

And now the final command

mv tmp.txt “Went sightseeing.gpx”

That should do it.

A big massive thanks to Mat for getting me sorted with this.

  • Just wanted to say thank you! I was going to build up a Find & Replace in a text editor, but sed did the trick nicely!

  • Dan Mlodecki

    lf you forgot to calibrate your power meter before your ride, this command will remove all power data:

    sed "/.*/d" strava.gpx > strava2.gpx

  • Kyle

    I need to do this to a file that has some outrageous power data. In what program do I open the .gpx file and where do i enter the ‘sed “/.*/d” strava.gpx > strava2.gpx’?

    Thanks,
    Kyle

    • This is done via Terminal.

  • Marco Veldhuijs

    What am I doing wrong when i get the following message?
    -bash: gpxtpx:hr: No such file or directory

    (sed “/.*/d” ~/Volumes/Opslag/Users/Marco/Downloads/er.gpx > tmp.txt)

    • It would seem from what I can tell that your er.gpx file isn’t the correct name or location.

  • Daniel

    I had to protect the / in the tag with a \

    Here my example:
    sed ‘/.*/d’ 2014-11-29_Pizolastock.gpx

    Elegant solution – Thanks for posting!

  • Mark

    Hi – great tip, thanks for that. To expand on a couple of the other comments, the command specified was failing for me until I added the ‘\’. Here’s the command that worked for me:

    cd ~/Downloads (assuming that this is where the file called MyRide.gpx is saved)

    sed “/.*/d” MyRide.gpx > tmp.txt

    Cheers,
    Mark

    • Mark

      Hmm… that’s not the command I wrote in my first post – would appear that your website is recognising special characters and then modifying the post…

      I’ll try again:
      sed “/.*/d” MyRide.gpx > tmp.txt

      • Mark

        Ok – my text still isn’t appearing. To cut to the chase, I added a ‘/’ as follows:

        \/gpxtpx etc etc

        Thanks

  • Pingback: PLANINARENJE I PRIPREMA / LIČNI UGAO | PLANINA BLOG | FOTO: Croda Fiscalina di mezzo 2675mnv()