OpenStreetMap標誌 OpenStreetMap

Your personal little tagwatch script

於 26 九月 2008 由 vibrogEnglish發表。

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'/>

電郵圖示 Bluesky圖示 Facebook圖示 LinkedIn圖示 Mastodon圖示 Telegram圖示 X圖示

討論

Heinz2008年9月26日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

vibrog2008年9月26日23:36發表的評論

-E is for extended regexp, e.g. used for the grouping, and inserting a group in the output using \1.

Heinz2008年9月27日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

vibrog2008年9月27日12:06發表的評論

I'm glad you find it useful.
A further pipe through `sort -nr` will sort tags by frequency.

登入以留言