Biểu trưng OpenStreetMap OpenStreetMap

Your personal little tagwatch script

Do vibrog đăng vào 26 tháng 09 năm 2008 bằng English.

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

Biểu tượng thư điện tử Biểu tượng Bluesky Biểu tượng Facebook Biểu tượng LinkedIn Biểu tượng Mastodon Biểu tượng Telegram Biểu tượng X

Thảo luận

Bình luận của Heinz vào 26 tháng 09 năm 2008 lúc 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

Bình luận của vibrog vào 26 tháng 09 năm 2008 lúc 23:36

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

Bình luận của Heinz vào 27 tháng 09 năm 2008 lúc 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

Bình luận của vibrog vào 27 tháng 09 năm 2008 lúc 12:06

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

Đăng nhập để nhận xét