Created
December 5, 2010 23:36
Revisions
-
nifgraup revised this gist
Dec 5, 2010 . 2 changed files with 29 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,28 @@ #!/usr/bin/perl # Author: Björgvin Ragnarsson # License: Public Domain use OSM::osm; # PERL osm module by gary68 openOsmFile('Iceland.osm'); skipNodes(); ($wayId, $wayUser, $aRef1, @tags) = getWay(); while ($wayId != -1) { for($i = 0; exists $tags[0][$i]; $i++) { $key = substr($tags[0][$i], 0, 4); $val = substr($tags[0][$i], 5); if($key eq 'name') { print $val; last; } } print "\n"; ($wayId, $wayUser, $aRef1, @tags) = getWay(); } closeOsmFile(); This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -20,4 +20,4 @@ fi for n in $( echo $postalcodes ); do cat gotuskra.txt | iconv -f ISO_8859-1 -t $encoding | awk -v n="$n" 'BEGIN{FS=";"}{if ($2 == n) print $3}' done -
nifgraup created this gist
Dec 5, 2010 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,23 @@ #!/bin/sh # Author: Björgvin Ragnarsson # License: Public Domain encoding="UTF-8" # annað algengt: "ISO_8859-1" if [ "$1" = "--list-towns" ]; then awk 'BEGIN{FS=";"}{print $2}' postnumer.txt | uniq | iconv -f ISO_8859-1 -t $encoding exit elif [ "$1" = "--town" ]; then postalcodes=`cat postnumer.txt | iconv -f ISO_8859-1 -t $encoding | grep $2 | awk 'BEGIN{FS=";"}{print $1}'` elif [ "$1" = "--codes" ]; then postalcodes=$2 else echo "Usage:" echo " $0 --list-towns | --codes ""LIST_OF_POSTAL_CODES"" | --town TOWN" exit fi for n in $( echo $postalcodes ); do cat gotuskra.txt | iconv -f ISO_8859-1 -t $encoding | awk -v n="$n" 'BEGIN{FS=";"}{if ($2 == n) print $3}' done