simplify sbib, sdoi
This commit is contained in:
25
spubmed.sh
25
spubmed.sh
@@ -18,20 +18,16 @@ if [ "$1" == "-h" ] ; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
#Setup defaults
|
||||
styleSheet=${pubmedStyleSheet:-$HOME/bin/pubmed2bibtex.xsl}
|
||||
bibdFileOut=${bibdFileOut:-$HOME/projects/bibd/OMEGA.bib}
|
||||
pdfPathOut=${pdfPathOut:-$HOME/projects/bibd/papers}
|
||||
relPath=$(basename $pdfPathOut)
|
||||
set -e #exit if an error
|
||||
# set -v -x -e #debugging
|
||||
|
||||
#Setup defaults
|
||||
author=$1
|
||||
journal=$2
|
||||
year=$3
|
||||
|
||||
set -e #exit if an error
|
||||
|
||||
#curl's option globoff needed for using brackets in a uri
|
||||
uid=$(curl -s --globoff "https://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi?db=pubmed&term=$author[au]+AND+$journal[ta]+AND+$year[dp]&retmode=xml" | grep -E "<Id>[0-9]+</Id>" | sed -E "s#<Id>([0-9]+)</Id>#\1#")
|
||||
uid=$(curl -s --globoff "https://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi?db=pubmed&term=$author[au]+AND+$journal[ta]+AND+$year[dp]&retmode=xml" | grep -E "<Id>[0-9]+</Id>" | sed -E "s|<Id>([0-9]+)</Id>|\1|")
|
||||
|
||||
if [ -z "$uid" ]; then
|
||||
echo "pubmed id not found"
|
||||
@@ -45,16 +41,7 @@ if [[ $(echo $uid | wc -w) -gt 1 ]]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo $uid | xclip -selection clipboard
|
||||
echo $uid
|
||||
# echo $uid | xclip -selection clipboard
|
||||
echo $uid | wl-copy
|
||||
|
||||
# #request pubmed xml and transform into bibtex
|
||||
# curl -s "https://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi?db=pubmed&id=$uid&retmode=xml" > $uid.xml
|
||||
# xsltproc --novalid $styleSheet $uid.xml > $uid.bib
|
||||
#
|
||||
# #import bibtex
|
||||
# echo "importing $uid.bib"
|
||||
# cat $uid.bib >> $bibdFileOut
|
||||
#
|
||||
# #clean up
|
||||
# rm $uid.xml $uid.bib
|
||||
|
||||
Reference in New Issue
Block a user