I want to create a script that will let me download images from entire subreddits at once, but I'm currently stuck on just getting the links right (one problem at a time! ^^). Anyway, since I can't think of a way to determine what format the image in the link will be, I was hoping sed could be used to specify multiple extensions during replacement (e.g. (jpg|png|gif)), but this does not seem to work.
grep -E "href=\"/r/bacon/*" bacon.htm | sed "s .*/r/bacon/\(.*\)\".* http://i.imgur.com/\1.\(\jpg\|\png\|\gif\) "
http://i.imgur.com/foo.jpg http://i.imgur.com/foo.png http://i.imgur.com/foo.gif
Google also does not seem to have an answer to this, admittedly, weird problem or at least I am having trouble coming up with meaningful ways to describe it.
Any ideas or should I try this from a different angle?