title: Use curl to parse XML, get an image's URL and download it
body: <p>I want to write a shell script to get an image from an rss feed.
  Right now I have:</p>
  
  <pre><code>curl http://foo.com/rss.xml | grep -E '&lt;img src="http://www.foo.com/full/' | head -1 | sed -e 's/&lt;img src="//' -e 's/" alt=""//' -e 's/width="400"//' -e 's/  height="400" \/&gt;//' | sed 's/ //g'
  </code></pre>
  
  <p>This I use to grab the first occurence of an image URL in the file.
  Now I want to put this URL in a variable to use cURL again to download the image.
  Any help appreciated! (Also you might give tipps on how to better remove everything from the line with the URL. This is the line:</p>
  
  <pre><code> &lt;img src="http://www.nichtlustig.de/comics/full/100802.jpg" alt="" width="400" height="400" /&gt;
  </code></pre>
  
  <p>There's probably some better regex to remove everything except the URL than my solution.)
  Thanks in advance!</p>