-
Notifications
You must be signed in to change notification settings - Fork 0
/
gpxcleaner.pl
executable file
·41 lines (32 loc) · 1.15 KB
/
gpxcleaner.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/usr/bin/perl -w
use strict;
my $line;
while (<>) {
$line.=$_;
}
$line =~ s/\r//sgi;
#
$line =~ s/<hints>(.*?)<\/hints>/<encoded_hints>$1<\/encoded_hints>/sgi;
$line =~ s/xmlns="http:\/\/www.topografix.com\/GPX\/1\/0/xmlns="http:\/\/www.topografix.com\/GPX\/1\/1/sgi;
$line =~ s/version="1\.0"/version="1.1"/sgi;
$line =~ s/xml version="1\.1"/xml version="1.0"/sgi;
$line =~ s/(<desc>(.*?)<\/time>)/<metadata>$1<\/metadata>/si;
$line =~ s/<cache id="(\d+)" status="Available">/<cache id="$1" available="True" archived="False" xmlns="http:\/\/www.groundspeak.com\/cache\/1\/0">/sgi;
$line =~ s/<span.*?>//sgi;
$line =~ s/<\/span>//sgi;
$line =~ s/<img.*?>//sgi;
$line =~ s/<font.*?>//sgi;
$line =~ s/<\/font>//sgi;
$line =~ s/<p.*?>//sgi;
$line =~ s/<\/p>//sgi;
$line =~ s/&auml;/\xc3\xa4/sgi;
$line =~ s/&uuml;/\xc3\xbc/sgi;
$line =~ s/&ouml;/\xc3\xb6/sgi;
$line =~ s/&szlig;/\xc3\x9f/sgi;
$line =~ s/&Auml;/\xc3\x84/sgi;
$line =~ s/&Uuml;/\xc3\x9c/sgi;
$line =~ s/&ouml;/\xc3\x96/sgi;
$line =~ s/&quot;/"/sgi;
$line =~ s/&amp;/&/sgi;
$line =~ s/&nbsp;/_/sgi;
print $line;