-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathks.zdb-id-konkordanz.sh
More file actions
86 lines (72 loc) · 2.09 KB
/
ks.zdb-id-konkordanz.sh
File metadata and controls
86 lines (72 loc) · 2.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#!/bin/bash
# Diese Skript erstellt eine Konkordanz ZDB-ID <=> toscience-ID
#
# Änderungshistorie:
# Autor | Datum | Beschreibung
# --------------------+------------+----------------------------------------------------------------------
# Ingolf Kuss | 15.12.2022 | Neuanlage für EDOZWO-1022 (Vorbereitungen zum "Öffnen des Vorhangs")
# --------------------+------------+----------------------------------------------------------------------
# Der Pfad, in dem dieses Skript steht
scriptdir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd $scriptdir
source variables.conf
# Umgebungsvariablen
regalApi=$BACKEND
if [ ! -d $REGAL_LOGS ]; then
mkdir $REGAL_LOGS
fi
if [ ! -d $REGAL_TMP ]; then
mkdir $REGAL_TMP
fi
# bash-Funktionen
function stripOffQuotes {
local string=$1;
local len=${#string};
echo ${string:1:$len-2};
}
# Ergebnisliste in eine Datei schreiben
outdatei=`echo $0 | sed 's/^\.\///' | sed 's/\.sh$//'`".CSV"
echo "outdatei=$outdatei"
if [ -f $outdatei ]; then
rm $outdatei
fi
#aktdate=`date +"%d.%m.%Y"`
#echo "Aktuelles Datum: $aktdate" >> $mailbodydatei
echo "Hole alle Zeitschriften"
resultset=`curl -s -XGET $ELASTICSEARCH/${INDEXNAME}2/journal/_search -d'{"query":{"match_all":{}},"fields":["zdbId"],"size":"10000"}'`
# echo "resultset="
# echo $resultset | jq "."
echo "toscience-ID;ZDB-ID" > $outdatei
for hit in `echo $resultset | jq -c ".hits.hits[]"`
do
# echo "hit=";
# echo $hit | jq "."
unset id;
id=`echo $hit | jq "._id"`
id=$(stripOffQuotes $id)
# echo "id=$id";
if [ -z "$id" ]; then
continue;
fi
unset zdbid;
for elem in `echo $hit | jq -c ".fields[\"zdbId\"][]"`
do
zdbid=$elem;
zdbid=$(stripOffQuotes $zdbid)
break;
done
# echo "zdbid=$zdbid";
# Bearbeitung dieser id,cdate
echo "$id;$zdbid" >> $outdatei
id="";
zdbif="";
done
if [ -s $outdatei ]; then
# outdatei ist nicht leer
outdateisort=$REGAL_TMP/$outdatei.$$
sort $outdatei > $outdateisort
rm $outdatei
cat $outdateisort >> $outdatei
rm $outdateisort
fi
cd -