Skip to content

Instantly share code, notes, and snippets.

@davidrenne
Created February 2, 2015 23:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save davidrenne/db6896137a31791b3df6 to your computer and use it in GitHub Desktop.
Save davidrenne/db6896137a31791b3df6 to your computer and use it in GitHub Desktop.
Excel formula for wget grep image source
IF column A is an ID, and column C is a URL. Request the URL and get the single image on the page. Then create a new CSV off of this with the source of the image
=CONCATENATE("random_shit=`tr -cd '[:alnum:]' < /dev/urandom | fold -w30 | head -n1`;wget -O /tmp/html$random_shit ",C2655,"; grep '<img' /tmp/html$random_shit | grep -v 'beach-logo' | grep -oP 'src=""([^""]*)' | cut -b 6- > /tmp/html_$random_shit; value=`cat /tmp/html_$random_shit`; echo """,A2655,",$value"" >> /tmp/all; rm /tmp/html_$random_shit; rm /tmp/html$random_shit;")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment