Last active
May 4, 2016 20:33
-
-
Save chadmiller/15b2e22539f557fed8ef44af7620894a to your computer and use it in GitHub Desktop.
Orange County business licenses
This file contains 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 characters
#!/usr/bin/make -f | |
demo: orange-county-business-licenses.sqlite3 | |
sqlite3 $< "select count(*) g, description from business_licenses group by description order by g, description;" | |
orange-county-business-licenses.sqlite3: | |
sqlite3 $@ "create table business_licenses (category int not null, account text, businessname text, streetaddress text, citystatezip text, unknown1 int, unknown2 int, unknown3 int, owner text, description text, phonenumber text, licensuredate text);" | |
set -u; seq 220 |while read weeksago; do wget -nv -O - $$(date +"https://www.octaxcol.com/Octc/Downloads/LocalBusinessTax/Data/%Y-%m-%d.zip" --date "$$weeksago weeks ago Friday") |funzip |sed -e 1d |awk -F, 'BEGIN { OFS=FS } { if ($$11 == "000-000-0000") { $$11=""; } print }' |sqlite3 -bail -stats -cmd '.separator ","' $@ '.import /dev/stdin business_licenses'; done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment