commit 84b1126dd48d57e3a1f525f19f3d1654b27dcf3c parent 98931f5cbad0439d1908cd8a979f0af5cd6ac115 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(-)
diff --git a/getdoi b/getdoi @@ -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"