#!/bin/bash
+
+METAR=1
+TAF=1
+if [ "$1" == "-m" ]; then
+ METAR=1
+ TAF=0
+ shift
+elif [ "$1" == "-t" ]; then
+ METAR=0
+ TAF=1
+ shift
+fi
+
STATION=$1
-wget -q -O - http://weather.noaa.gov/mgetmetar.php?cccc=$STATION \
- | grep -i $STATION \
- | tail -1
+if [ $METAR -eq 1 ]; then
+ # METAR
+ wget -q -O - http://weather.noaa.gov/mgetmetar.php?cccc=$STATION \
+ | grep -i $STATION \
+ | tail -1
+fi
+
+if [ $TAF -eq 1 ]; then
+ # TAF
+ wget -q -O - http://weather.noaa.gov/cgi-bin/mgettaf.pl?cccc=$STATION \
+ | awk '/<pre>/, /<\/pre>/ { print }' \
+ | sed -e 's/<[/]*\w\+>//g' -e 's/^ \+/ /g'
+fi
+