Skip to content

Instantly share code, notes, and snippets.

@davidvanvickle
Created December 31, 2011 00:32
Show Gist options
  • Save davidvanvickle/1542205 to your computer and use it in GitHub Desktop.
Save davidvanvickle/1542205 to your computer and use it in GitHub Desktop.
shell - read xml value
if [ -e "yfollowers" ]
then
NAMES=`cat yfollowers`
for value in $NAMES
do
if [[ $value =~ \<screen_name\>([0-9a-zA-Z_]*)\<\/screen_name\> ]];then
i=1
n=${#BASH_REMATCH[*]}
while [[ $i -lt $n ]]
do
u=${BASH_REMATCH[$i]}
echo $u
echo $u >> tmp
let i++
break
done
shift
fi
done
rm yfollowers
if [ -e "followers" ]
then
rm followers
fi
sort tmp | uniq > followers
rm tmp
else
echo "no followers"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment