Skip to content

Instantly share code, notes, and snippets.

@timoyuen
Forked from cjus/jsonval.sh
Created February 19, 2014 09:04
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 timoyuen/9088456 to your computer and use it in GitHub Desktop.
Save timoyuen/9088456 to your computer and use it in GitHub Desktop.
#!/bin/bash
function jsonval {
temp=`echo $json | sed 's/\\\\\//\//g' | sed 's/[{}]//g' | awk -v k="text" '{n=split($0,a,","); for (i=1; i<=n; i++) print a[i]}' | sed 's/\"\:\"/\|/g' | sed 's/[\,]/ /g' | sed 's/\"//g' | grep -w $prop`
echo ${temp##*|}
}
json=`curl -s -X GET http://twitter.com/users/show/$1.json`
prop='profile_image_url'
picurl=`jsonval`
`curl -s -X GET $picurl -o $1.png`
@timoyuen
Copy link
Author

sed 's/\////g' | sed 's/[{}]//g' | awk -v k="text" '{n=split($0,a,","); for (i=1; i<=n; i++) print a[i]}' | sed 's/":"/|/g' | sed 's/[,]/ /g' | sed 's/"//g' | grep -w $prop| cut -d":" -f2| sed -e 's/^ *//g' -e 's/ *$//g'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment