#!/bin/bash notags() { while read line; do echo $line | sed -e "s/<[^>]*>/ /g" -e "s/ / /g" done } user=$1 wanted=$2 list=`curl -s http://gist.github.com/api/v1/xml/gists/${user}` repos=`echo $list | xmlstarlet sel -t -c "gists/gist/repo" | notags` for repo in $repos; do files=`echo $list | xmlstarlet sel -t -c "gists/gist[repo=${repo}]/files/file/file" | notags` for file in $files; do if [[ $file == $wanted ]]; then curl -s https://gist.github.com/raw/$repo/$file fi done done