tImprove doi detection in pdf files - scholarref - tools for DOI and BiBTeX reference extraction, fetching, and parsing
(HTM) git clone git://src.adamsgaard.dk/scholarref
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
(DIR) LICENSE
---
(DIR) commit 84b1126dd48d57e3a1f525f19f3d1654b27dcf3c
(DIR) parent 98931f5cbad0439d1908cd8a979f0af5cd6ac115
(HTM) Author: Anders Damsgaard <anders@adamsgaard.dk>
Date: Tue, 19 Nov 2019 10:19:45 +0100
Improve doi detection in pdf files
Diffstat:
M getdoi | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
---
(DIR) diff --git a/getdoi b/getdoi
t@@ -64,9 +64,9 @@ get_doi_from_crossref() {
}
get_doi_from_file() {
- doi=$(pdfinfo "$1" | grep -io "doi.*") ||
- doi=$(pdftotext "$1" 2>/dev/null - | grep -io "doi.*" -m 1 ) ||
- die "Error: Could not extract DOI from file $doi"
+ doi=$(pdfinfo "$1" | grep -io "doi.*" -m 1) ||
+ doi=$(pdftotext "$1" 2>/dev/null - | grep -io "doi.*" -m 1) ||
+ die "Error: Could not extract DOI from file $1"
doi=$(echo "$doi" | sed 's/[A-Za-z\.\/:]*//;s/[\.,]$//' |\
sed 's/.*\(10\.\)/\1/' | cut -d' ' -f1 | sed 's/,//g')
echo "$doi"