I've been struggling with this one for hours and would appreciate any help I can get please. If necessary I'll dust off WildEdit instead, although I've used that so infrequently that it will require some re-learning.
I have a file (it's a GPX file made from a GPS recording) that looks like the following:
<?xml version="1.0" encoding="ISO-8859-1"?>
<gpx version="1.1"
creator="Memory-Map 5.4.2.1089 http://www.memory-map.com"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://www.topografix.com/GPX/1/1"
xsi:schemaLocation="http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd">
<trk>
<name>20110804-C2C-Day11</name>
<type>C2C ALL:C2C Actual</type>
<trkseg>
<trkpt lat="54.4016646067" lon="-1.7415888468"><ele>135</ele><time>2011-08-04T07:38:47Z</time></trkpt>
<trkpt lat="54.4006636620" lon="-1.7413808187"><ele>-19</ele><time>2011-08-04T07:39:26Z</time></trkpt>
<trkpt lat="54.4002325058" lon="-1.7411432902"><ele>-5</ele><time>2011-08-04T07:39:36Z</time></trkpt>
<trkpt lat="54.4006869952" lon="-1.7412222544"><ele>43</ele><time>2011-08-04T07:41:03Z</time></trkpt>
<trkpt lat="54.4008838336" lon="-1.7404953639"><ele>66</ele><time>2011-08-04T07:42:17Z</time></trkpt>
<trkpt lat="54.4005348206" lon="-1.7400047938"><ele>70</ele><time>2011-08-04T07:43:14Z</time></trkpt>
<trkpt lat="54.4001293182" lon="-1.7396299998"><ele>74</ele><time>2011-08-04T07:44:07Z</time></trkpt>
<trkpt lat="54.4002803802" lon="-1.7389022827"><ele>78</ele><time>2011-08-04T07:44:48Z</time></trkpt>
<trkpt lat="54.4005850792" lon="-1.7383123398"><ele>107</ele><time>2011-08-04T07:53:24Z</time></trkpt>
<trkpt lat="54.4005350431" lon="-1.7375241597"><ele>107</ele><time>2011-08-04T07:53:55Z</time></trkpt>
<trkpt lat="54.4003473600" lon="-1.7368014018"><ele>107</ele><time>2011-08-04T07:54:27Z</time></trkpt>
<trkpt lat="54.4002641996" lon="-1.7360345840"><ele>105</ele><time>2011-08-04T07:55:12Z</time></trkpt>
etc (400-600 lines typically).
I want to end up with a file containing only the times, like this:
07:38:47
07:39:26
07:39:36
07:41:03
07:42:17
07:43:14
07:44:07
07:44:48
07:53:24
07:53:55
07:54:27
07:55:12
The snag is that these strings vary in position because unfortunately elevation data varies in width. Otherwise I could do it easily with a macro.
However, these strings are easily identified by a digit and 'T' on their immediate left, and 'Z<' on their right.
Note that the first 10 'header' lines are all unwanted.
I'm hoping one of the experts can help please.
--
Terry, East Grinstead, UK
Removing all but a certain string?
Moderators: AmigoJack, bbadmin, helios, MudGuard
-
ben_josephs
- Posts: 2464
- Joined: Sun Mar 02, 2003 9:22 pm
Getting rid of the header lines is easy.
To extract the times, try this:
Use "Posix" regular expression syntax:
To extract the times, try this:
Use "Posix" regular expression syntax:
Search | Replace... (<F8>):Configure | Preferences | Editor
[X] Use POSIX regular expression syntax
Find what: .*>[0-9]{4}-[0-9]{2}-[0-9]{2}T([0-9]{2}:[0-9]{2}:[0-9]{2})Z<.*
Replace with: \1
[X] Regular expression
Replace All