Created
April 2, 2018 15:00
-
-
Save bathtime/113bf195a5da50e475ee11fd6b91bf63 to your computer and use it in GitHub Desktop.
Weather
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/sh | |
URL="https://weather.gc.ca/city/pages/on-77_metric_e.html" | |
A='center">' | |
B='</p>' | |
C='>' | |
D='°' | |
echo $(wget -q -O- "$URL" | awk -v v1="$A" -v v2="$B" -v v3="$C" -v v4="$D" '$0 ~ v1 ".*" v2 {sub(v2 ".*", ""); sub(".*" v1, ""); print $0; next;} $0 ~ v3 ".*" v4 {sub(v4 ".*", ""); sub(".*" v3, ""); print $0 "°C"; exit}') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment