You have to put quotes around that URL! Left unquoted, Bash (or whatever shell you're using) sees the &
as a request to run wget
in the background - and the format parameter, which comes after the &
is never sent to the server. Try this instead:
wget -qO- 'http://www.wunderground.com/weatherstation/WXDailyHistory.asp?ID=KPAPALMY1&format=1' | sed 's+<br>++g' > $1.csv
Note that I tweaked your sed
command, too - the <br>
s you're getting don't have the terminating slash. Also: Deleting those <br>
s means that only every other line has data. Hopefully that won't be a problem, as deleting newlines with sed
is a bit of a pain, but if it is, see this question for how to do it.
Hope that helps!
` tags thrown in, and each line seems to end with an unnecessary comma. – Xavier Holt Oct 27 '12 at 13:58