Skip to content

Instantly share code, notes, and snippets.

@jaymzcd
Created August 12, 2010 14:24
Show Gist options
  • Select an option

  • Save jaymzcd/521043 to your computer and use it in GitHub Desktop.

Select an option

Save jaymzcd/521043 to your computer and use it in GitHub Desktop.
grabProfilePics.sh
#!/bin/bash
# Takes the XML file from Dan with UIDs & Profile pic urls and turns it into
# a CSV which we then run through AWK to populate some variables. These then
# pass through to wget to save out the profile in the format UID.EXT
TMP_CSV=/tmp/photos.csv;
PROFILE_FILE=/home/jaymz/documents/vans/vans-usa/data-export/20100811/user_photos.xml;
cat $PROFILE_FILE | sed -e 's/.*uid="\(.*\)" url="\(.*\)".*/\1,\2/g' > $TMP_CSV;
while read line;
do
LBID=`echo $line | awk -F, '{print $1}'`;
URL=`echo $line | awk -F, '{print $2}'`;
EXT=${URL: -4};
wget -O /tmp/profile/$LBID$EXT $URL;
done < $TMP_CSV;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment