Skip to content

Instantly share code, notes, and snippets.

@smellslikeml
Created October 21, 2018 18:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save smellslikeml/06269acca0e1edf5dc3ace23037346fd to your computer and use it in GitHub Desktop.
Save smellslikeml/06269acca0e1edf5dc3ace23037346fd to your computer and use it in GitHub Desktop.
zipcode lookup
#!/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