Skip to content

Instantly share code, notes, and snippets.

@timhodson
Created December 2, 2013 16:00
Show Gist options
  • Save timhodson/7751723 to your computer and use it in GitHub Desktop.
Save timhodson/7751723 to your computer and use it in GitHub Desktop.
Get files from crossref for any DOI in a .ris file. That newline in the sed command is supposed to be there
#!/bin/bash
#usage: ./getDOIfiles myRisFile.ris
if [[ -z $CROSSREF_PID ]]
then
echo "CROSSREF_PID is not set in your env"
exit
fi
for val in `grep "^DO" $1 | cut -d " " -f 4 | sed -e s/
//`
do
doi=$val
url="http://doi.crossref.org/servlet/query?format=unixref&id=${doi}&pid=$CROSSREF_PID"
echo $url
file=`echo $doi | sed -e 's|/|_|g'`
curl -v $url -o "${file}.xml"
done
#ends
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment