cp tweets-fans.xml-cp tweets-fans.xml FILEIN=tweets-fans.xml FILEOUT=tweets-fans-tmp.xml for img in `cat $FILEIN |grep "" | sed 's/\ \ //' |sed 's/<\/profile_image_url>//'` do echo wget $img -O `echo $img |sed 's/http:\/\/a\(.*\).twimg.com\///'` done sed 's/http:\/\/a\(.*\).twimg.com\//http:\/\/myurl\//' $FILEIN > $FILEOUT cp $FILEOUT $FILEIN