Created
February 8, 2014 00:04
-
-
Save bonetechnologies/8874508 to your computer and use it in GitHub Desktop.
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
#!/bin/bash | |
COUNTIES="clackamas multnomah washington" | |
#Get the pages and print it via STDOUT. | |
#HTTP_GET_COMMAND="wget -qO- " | |
HTTP_GET_COMMAND="curl -s " | |
ALL_OUTAGES_NUM=0 | |
for county in $COUNTIES; | |
do | |
echo -n "${county}: " | |
OUTAGES_NUM=$(${HTTP_GET_COMMAND} http://www.portlandgeneral.com/safety_outages/outages/outage_updates/outage_detail.aspx\?county\=${county} | grep "ctl00_ctl00_GlobalContentWell_ZContentWell_rptCountyDetail" | grep Customers | awk -F"Customers\">" '{ print $2 }' | sed 's/\<.*$//g'| awk '{total = total + $1}END{print total}') | |
ALL_OUTAGES_NUM=`expr $OUTAGES_NUM + $ALL_OUTAGES_NUM` | |
echo ${OUTAGES_NUM} | |
done | |
echo "-------------------------" | |
echo "total: ${ALL_OUTAGES_NUM} customers without power." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment