From: Nicolas Boisselier Date: Thu, 4 Jan 2018 00:07:29 +0000 (+0000) Subject: share/sql/zipcode.sql X-Git-Url: https://git.nbdom.net/?a=commitdiff_plain;h=1de8dc459305436bb29a46804cc21763bd99e36d;p=nb.git share/sql/zipcode.sql --- diff --git a/share/db/timezone b/share/db/timezone index 7c1f5155..07238622 100755 --- a/share/db/timezone +++ b/share/db/timezone @@ -8,7 +8,6 @@ while (<>) { next unless $i++; chomp($_); @_ = (split("\t",$_))[1,2,3,4]; - #push @_,0 if (@_<4); #$_[1] = join("\t",reverse split('/',$_[1])); print join ("\t",@_)."\n"; } diff --git a/share/db/zipcode b/share/db/zipcode deleted file mode 100755 index c9ce2559..00000000 --- a/share/db/zipcode +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/env perl -use strict; -use warnings; -#exec('curl -s http://download.geonames.org/export/zip/allCountries.zip | zcat'); -#exit; -@ARGV = ('curl -s http://download.geonames.org/export/zip/allCountries.zip | zcat |'); - -while (<>) { - chomp($_); - @_ = split("\t",$_); - print join ("\t",@_)."\n"; -} diff --git a/share/sql/zipcode b/share/sql/zipcode new file mode 100755 index 00000000..c91bcc47 --- /dev/null +++ b/share/sql/zipcode @@ -0,0 +1,20 @@ +#!/usr/bin/env perl +use strict; +use warnings; +#exec('curl -s http://download.geonames.org/export/zip/allCountries.zip | zcat'); +#exit; +@ARGV = ('curl -s http://download.geonames.org/export/zip/allCountries.zip | zcat |'); + +while (<>) { + chomp($_); + s,\\\t,\t,g; # fix error + @_ = split("\t",$_); + push @_,0 if (@_<12); + + $_ = $_[0]; + $_[0] = $_[1]; + $_[1] = $_; + + + print join ("\t",@_)."\n"; +}