[H-GEN] regex brian fade

mick bareman at tpg.com.au
Fri Jun 5 00:16:16 EDT 2015


I'm trying to extract occurrances of <tag k="(KEY)" from an openstreetmap XML file where KEY is a random number of characters a-z, A-Z 0-9 or :(colon). I'm sure I've done it before but can't remember how. Below is the closest I can get

grep -o -e "<tag k=\"[a-z]" ~/Documents/gis/OSM-AU/new_south_wales.osm

this is a sample of the lines as they appear in the file. 

<tag k="highway" v="traffic_signals"/>
<tag k="source" v="yahoo"/>
<tag k="highway" v="traffic_signals"/>
<tag k="highway" v="traffic_signals"/>
<tag k="highway" v="traffic_signals"/>
</node>
<node id="624849" version="4" timestamp="2010-11-07T10:58:40Z" uid="7617" user="Franc" changeset="6310020" lat="-33.8921412" lon="151.2170508"/>
<node id="624854" version="2" timestamp="2010-01-24T00:54:32Z" uid="12203" user="brainwad" changeset="3697387" lat="-33.8954355" lon="151.2219617">
<tag k="crossing" v="traffic_signals"/>
<tag k="highway" v="traffic_signals"/>

mick


More information about the General mailing list