I'm trying to extract the 2 attributes "lat" and "lon" from a file with the following format:
<trkpt lat="38.8577288" lon="-9.0997973"/>
<trkpt lat="38.8576367" lon="-9.1000557"/>
<trkpt lat="38.8575259" lon="-9.1006374"/>
...
and get the following output:
-9.0997973,38.8577288
-9.1000557,38.8576367
-9.1006374,38.8575259
(Yes the lat/lon pair are inverted on purpose)
I don't know much about regex, but looking around on the web, this is all I was able to achieve:
grep 'lat="[^"]*"' doc.txt | grep -no 'lat="[^"]*"'
output:
1:lat="38.8577288"
2:lat="38.8576367"
3:lat="38.8575259"
I'm not sure how to get going with this... Thanks in advance for your help