Skip to content

Instantly share code, notes, and snippets.

@TApplencourt
Last active August 29, 2015 14:24
Show Gist options
  • Save TApplencourt/c532f0eb820a200b79a3 to your computer and use it in GitHub Desktop.
Save TApplencourt/c532f0eb820a200b79a3 to your computer and use it in GitHub Desktop.
From a isbn or a doi get the bibtex
#!/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 ""
@TApplencourt
Copy link
Author

./get_bibtex.sh doi 10.1063/1.4903985
@article{Scemama_2014,
    doi = {10.1063/1.4903985},
    url = {http://dx.doi.org/10.1063/1.4903985},
    year = 2014,
    month = {dec},
    publisher = {{AIP} Publishing},
    volume = {141},
    number = {24},
    pages = {244110},
    author = {A. Scemama and T. Applencourt and E. Giner and M. Caffarel},
    title = {Accurate nonrelativistic ground-state energies of 3d transition metal atoms},
    journal = {J. Chem. Phys.}
}

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