camping summer

This commit is contained in:
ackman678
2021-09-18 15:46:10 -07:00
parent 3cb839de7a
commit 2c2f3bdf77
6 changed files with 17 additions and 37 deletions

14
spdf.sh
View File

@@ -8,7 +8,7 @@ if [ "$1" == "-h" ] ; then
depends:
pdftotext - from ghostscript or poppler or texlive ?
xsltproc - xml processor, from GNOME project
xsltproc, xmllint - xml programs from libxml
pubmed2bibtex.xsl - xml processor stylesheet
defaults:
@@ -26,26 +26,14 @@ fn=$1
#try to extract doi from pdf and retrieve a pubmed id
#for 'DOI:' syntax
# doi=$(pdftotext -q -f 1 -l 1 $fn - | grep -i "doi:" --max-count=1 | tr [:upper:] [:lower:] | sed -E "s|doi:(.+)|\1|")
# search for doi string between first page last page 10
doi=$(pdftotext -q -f 1 -l 10 $fn - | grep -iE "doi:? ?/?10\." --max-count=1 | tr [:upper:] [:lower:] | sed -E "s|.*doi:? ?/?(10.+)|\1|")
#for 'https://doi.org' syntax
if [ -z "$doi" ]; then
doi=$(pdftotext -q -f 1 -l 1 $fn - | grep -iE "doi\.org/10\." --max-count=1 | tr [:upper:] [:lower:] | sed -E "s|.+doi\.org/(10.+)|\1|")
fi
# for 'https://doi.org' syntax
# if [ -z "$doi" ]; then
# doi=$(pdftotext -q -f 1 -l 1 $fn - | grep -i "doi.org/" --max-count=1 | tr [:upper:] [:lower:] | sed -E "s|.+doi\.org\/(.+)|\1|")
# fi
#
# if [ -z "$doi" ]; then
# doi=$(pdftotext -q -f 1 -l 1 $fn - | grep -iE "doi ?" --max-count=1 | tr [:upper:] [:lower:] | sed -E "s|doi ?(.+)|\1|")
# fi
if [ -z "$doi" ]; then
echo "doi not found"
exit 1