Created
June 29, 2015 12:58
-
-
Save cquest/3fe739e2932008dac949 to your computer and use it in GitHub Desktop.
shell script to extract vote counts by location into CSV file from okfnindex2015 voting
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 characters
# get votes from the map (curl) | |
# extract the lines containing values and reformat as csv (grep, sed) | |
echo "lat,lon,votes,location,country" > votes.csv | |
curl 'http://allourideas.org/globalopendataindex15/voter_map?type=votes' \ | |
| grep "data.setValue" votes.html \ | |
| sed 's/.*data.setValue([0-9]*, //;s/);//;s/, /,/' \ | |
| sed 'N;s/\n[1-3]//' | sed 'N;s/\n[1-3]//' \ | |
| sed 's/, \(..\)"$/",\1/;s/ ,"/,"/;s/^0,//' \ | |
>> votes.csv |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment