Created
December 2, 2013 16:00
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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