Carlos E. R. wrote:
The problem is here:
cer@Isengard:~> grep -m 1 jpg /tmp/apod.html | sed -e 's/<//' -e 's/>//' -e 's/.*=//' -e 's/"//g' -e 's/^/http:\/\/apod.nasa.gov\/apod\//' http://apod.nasa.gov/apod/image/1602/Tarantula-HST-ESO-annotated1800.jpgArou... the Tarantula</a> cer@Isengard:~>
That sed "script" is an abomination. Try this: grep -m1 href.*jpg /tmp/apod.html |\ sed -e 's@^.*href="\([^"]\+\)".*$@http://apod.nasa.gov/apod/\1@' For non-sed-speakers: Given the one line of <a href="image/1602/Tarantula-HST-ESO-annotated1800.jpg">Around the Tarantula</a the translation is roughly - grab the text enclosed in double quotes and prepend the base url. Combine it all into a one-liner (ignore the folding): grep -m1 href.*jpg /tmp/apod.html |\ sed -e 's@^.*href="\([^"]\+\)".*$@http://apod.nasa.gov/apod/\1@' |\ wget -i - -- Per Jessen, Zürich (13.8°C) Member, openSUSE Heroes (2016 - present) We're hiring - https://en.opensuse.org/openSUSE:Heroes