Skip to content

Instantly share code, notes, and snippets.

@bviktor
Created November 27, 2025 14:24
Show Gist options
  • Select an option

  • Save bviktor/6e7f360c3bb26dc96c26aebeb45bee6f to your computer and use it in GitHub Desktop.

Select an option

Save bviktor/6e7f360c3bb26dc96c26aebeb45bee6f to your computer and use it in GitHub Desktop.
Script to remove personal data from your Strava workouts so that you can publish it as a GPX route
#!/bin/bash
TARGET="../edit/${1}"
# remove HR and steps
xmlstarlet ed --pf -d '_:gpx/_:trk/_:trkseg/_:trkpt/_:extensions' "${1}" > "${TARGET}"
# remove banners
xmlstarlet ed -L --pf -d '_:gpx/_:metadata' "${TARGET}"
# remove timestamps
xmlstarlet ed -L --pf -d '_:gpx/_:trk/_:trkseg/_:trkpt/_:time' "${TARGET}"
# remove emtpy lines caused by --pf
sed -i '/^[[:space:]]*$/d' "${TARGET}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment