OpenStreetMap 로고 OpenStreetMap

Your personal little tagwatch script

vibrog님이 English로 2008년 9월 26일에 게시함.

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 아이콘 마스토돈 아이콘 텔레그램 아이콘 X 아이콘

토론

2008년 9월 26일 22:18Heinz님의 의견

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

2008년 9월 26일 23:36vibrog님의 의견

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

2008년 9월 27일 10:13Heinz님의 의견

That explains it, thanks.
Using -r or --regexp-extended works now in my "GNU sed Version 4.1.5"
and shows interesting results.
Heinz

2008년 9월 27일 12:06vibrog님의 의견

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

댓글을 남기려면 로그인하세요