Created
October 21, 2018 18:06
-
-
Save smellslikeml/06269acca0e1edf5dc3ace23037346fd to your computer and use it in GitHub Desktop.
zipcode lookup
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
#!/bin/bash | |
# zipcode--Given a ZIP code, identifies the city and state. Use city-data.com, | |
# which has every ZIP code configured as its own web page. | |
baseURL="http://www.city-data.com/zips" | |
/bin/echo -n "ZIP code $1 is in " | |
curl -s -dump "$baseURL/$1.html" | \ | |
grep -i '<title>' | \ | |
cut -d\( -f2 | cut -d\) -f1 | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment