Author Topic: [Tasker] Remove timestamps from GPX files  (Read 220 times)

Offline tapio

  • Expert
  • Master of Locus
  • ****
  • Posts: 749
  • Thanked: 166 times
    • View Profile
[Tasker] Remove timestamps from GPX files
« on: November 14, 2021, 18:09:56 »
With the following Tasker task you can remove all timestamps from GPX files, a privacy option. Locus does only export GPX with timestamps.
Backup your files. It's not too thoroughly tested.

https://taskernet.com/shares/?user=AS35m8kdDIMDeveQcQfRglam%2Fah1mTW%2FWcg05FZ39c0i1q%2F77iY3E7cIwxCkXqJTaTA%3D&id=Task%3ARemoveTimestampsGPX
« Last Edit: November 15, 2021, 10:37:36 by tapio »
 
The following users thanked this post: Andrew Heard

Offline Andrew Heard

  • Expert
  • Professor of Locus
  • *****
  • Posts: 1002
  • Thanked: 88 times
    • View Profile
  • Device: Samsung Galaxy A5 v8.1, Samsung Tab A7 v10
Re: [Tasker] Remove timestamps frim GPX files
« Reply #1 on: November 14, 2021, 22:01:57 »
I see the main processing is done via the line
Code: [Select]
sed -i -z 's;[\s\t]*&lt;time&gt;[^&lt;]*&lt;/time&gt;[^&lt;]*;;g' '%file'</Str>very clever. Thanks for sharing @tapio.
LM4.4.3.12 GOLD
 

Offline tapio

  • Expert
  • Master of Locus
  • ****
  • Posts: 749
  • Thanked: 166 times
    • View Profile
Re: [Tasker] Remove timestamps from GPX files
« Reply #2 on: November 15, 2021, 10:30:50 »
I see the main processing is done via the line
Code: [Select]
sed -i -z 's;[\s\t]*<time>[^<]*</time>[^<]*;;g'
Thx. Yeah, even if you're good at regex, sed is always tricky; it's especially the CRLF treatment of it, so I was happy about the -z option. Took me a while. The greedy matching of regex and multiple occurences of the same tags is also a thing always...
Just wanted to create a basic task. GPX files sometimes differ, e.g. some apps create a more flat output with nested xml tags and one trkpt per line...

Your next posting will be #1000 :)
« Last Edit: November 15, 2021, 10:39:01 by tapio »