curl -g "http://osmxapi.hypercube.telascience.org/api/0.5/*[osm:user=$username]" \
| grep '<tag ' | sed -E "s/<tag k='(.*(name|ref)|note|ele|layer|is_in)' v=.*\/>/<tag k=\'\1\' v='*'\/>/" \
| sort | uniq -c
Example output (shortened):
117 <tag k='bicycle' v='yes'/>
1075 <tag k='highway' v='footway'/>
489 <tag k='highway' v='track'/>
268 <tag k='highway' v='unclassified'/>
72 <tag k='landuse' v='farm'/>
284 <tag k='marked_trail' v='blue'/>
435 <tag k='name' v='*'/>
18 <tag k='natural' v='wood'/>
199 <tag k='route' v='ski'/>
118 <tag k='source' v='survey'/>
151 <tag k='tracktype' v='grade4'/>
9 <tag k='trail_visibility' v='intermediate'/>
Discussion
Comment from Heinz on 26 September 2008 at 22:18
Hi,
Can you please give an example of the output? On my box sed doesn't have an -E option and complains.
Please explain what the script should do. Thanks
Heinz
Comment from vibrog on 26 September 2008 at 23:36
-E is for extended regexp, e.g. used for the grouping, and inserting a group in the output using \1.
Comment from Heinz on 27 September 2008 at 10:13
That explains it, thanks.
Using -r or --regexp-extended works now in my "GNU sed Version 4.1.5"
and shows interesting results.
Heinz
Comment from vibrog on 27 September 2008 at 12:06
I'm glad you find it useful.
A further pipe through `sort -nr` will sort tags by frequency.