https://github.com/devlights/go-kenall-example
郵便番号データ、通称 KEN_ALL でファイル操作を行っているサンプルです。(新しく追加された utf_all.csv を使っています)
https://github.com/devlights/go-kenall-example
Last synced: about 2 months ago
JSON representation
郵便番号データ、通称 KEN_ALL でファイル操作を行っているサンプルです。(新しく追加された utf_all.csv を使っています)
- Host: GitHub
- URL: https://github.com/devlights/go-kenall-example
- Owner: devlights
- License: mit
- Created: 2023-07-16T17:10:54.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2023-07-17T09:46:39.000Z (almost 2 years ago)
- Last Synced: 2025-02-12T08:58:29.709Z (4 months ago)
- Language: Go
- Size: 12.7 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# go-kenall-example
郵便番号データ、通称 KEN_ALL でファイル操作を行っているサンプルです。
(新しく追加された utf_all.csv を使っています)

## Environments
```sh
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 22.04.2 LTS
Release: 22.04
Codename: jammy$ go version
go version go1.20.5 linux/amd64
```## Requirements
### [Task](https://taskfile.dev/)
```sh
$ go install github.com/go-task/task/v3/cmd/task@latest
```## How to
### Run (on Gitpod)
```sh
$ task download
task: [download] wget https://www.post.japanpost.jp/zipcode/utf_all.csv
--2023-07-16 17:46:56-- https://www.post.japanpost.jp/zipcode/utf_all.csv
Resolving www.post.japanpost.jp (www.post.japanpost.jp)... 43.253.212.17
Connecting to www.post.japanpost.jp (www.post.japanpost.jp)|43.253.212.17|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 18305986 (17M) [text/csv]
Saving to: ‘utf_all.csv’utf_all.csv 100%[========================================================>] 17.46M 1.89MB/s in 10s
2023-07-16 17:47:07 (1.70 MB/s) - ‘utf_all.csv’ saved [18305986/18305986]
task: [download] file -i utf_all.csv
utf_all.csv: text/csv; charset=utf-8
task: [download] wc -l utf_all.csv
124270 utf_all.csv
task: [download] ls -lh utf_all.csv | awk '{print $5}'
18M
``````sh
$ task run
task: [run] go build
task: [run] ./kenall "^東京.*銀座"
東京都中央区銀座
======================================
task: [run] ./kenall "^[^(東京)].*銀座"
北海道夕張郡長沼町銀座
栃木県鹿沼市銀座
埼玉県熊谷市銀座
埼玉県本庄市銀座
富山県富山市新庄銀座
長野県岡谷市銀座
長野県岡谷市東銀座
長野県飯田市銀座
静岡県静岡市清水区銀座
静岡県熱海市銀座町
静岡県伊東市銀座元町
愛知県半田市銀座本町
愛知県刈谷市銀座
滋賀県彦根市銀座町
山口県周南市銀座
山口県周南市みなみ銀座
徳島県徳島市銀座
福岡県北九州市戸畑区銀座
```## 参考情報
- https://www.post.japanpost.jp/zipcode/download.html
- https://devlights.hatenablog.com/entry/2023/07/14/073000