Created
August 12, 2010 14:24
-
-
Save jaymzcd/521043 to your computer and use it in GitHub Desktop.
grabProfilePics.sh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/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