Last active
August 29, 2015 14:24
-
-
Save TApplencourt/c532f0eb820a200b79a3 to your computer and use it in GitHub Desktop.
From a isbn or a doi get the bibtex
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 | |
str_utilisation="$0 (doi|isbn) <value>" | |
if [ "$#" -ne 2 ];then | |
echo ${str_utilisation} | |
exit 1 | |
fi | |
if [ "$1" == "doi" ];then | |
doi_raw=$2 | |
curl -G --data-urlencode "id=$doi_raw" "http://www.doi2bib.org/doi2bib" | |
elif [ "$1" == "isbn" ];then | |
isbn=$2 | |
curl -silent "http://www.ottobib.com/isbn/${isbn}/bibtex" | perl -l -0777 -ne 'print $1 if /<textarea.*?>\s*(.*?)\s*<\/textarea/si' | |
else | |
echo ${str_utilisation} | |
fi | |
echo "" |
Author
TApplencourt
commented
Jul 8, 2015
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment