I want to write a shell script to get an image from an rss feed. Right now I have:
curl http://foo.com/rss.xml | grep -E '<img src="http://www.foo.com/full/' | head -1 | sed -e 's/<img src="//' -e 's/" alt=""//' -e 's/width="400"//' -e 's/ height="400" \/>//' | sed 's/ //g'
I use this to capture the first appearance of the image URL in the file. Now I want this URL in the variable to use cURL again to load the image. Any help appreciated! (You can also give tips on how best to remove everything from the string with the URL. This is the string:
<img src="http://www.nichtlustig.de/comics/full/100802.jpg" alt="" width="400" height="400" />
Perhaps there is some better regex for removing everything except the url than my solution.) Thanks in advance!
source
share