-
Notifications
You must be signed in to change notification settings - Fork 0
/
process_bib.sh
executable file
·149 lines (129 loc) · 11.8 KB
/
process_bib.sh
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
#!/bin/bash
# get me vim, we will be using it alot to postprocess the generated json files
if [ -x "$(whereis nvim | awk '{print $2}')" ]; then
VIM_BIN="$(whereis nvim | awk '{print $2}')"
HEADLESS="--headless"
elif [ -x "$(whereis vim | awk '{print $2}')" ]; then
VIM_BIN="$(whereis vim | awk '{print $2}')"
HEADLESS=""
fi
INPUT_FILE=zotero_export.bib
OUTPUT_FILE=main.bib
cp $INPUT_FILE $OUTPUT_FILE
# Replace \textendash{} and \textemdash{}
$VIM_BIN $HEADLESS -nEs -c "set ignorecase" -c "%s/\\\textendash{}/--/g" -c "wqa" -- "$OUTPUT_FILE"
$VIM_BIN $HEADLESS -nEs -c "set ignorecase" -c "%s/\\\textemdash{}/---/g" -c "wqa" -- "$OUTPUT_FILE"
# Remove {} in author
$VIM_BIN $HEADLESS -nEs -c '%g/author.*=/s/{//g' -c "wqa" -- "$OUTPUT_FILE"
$VIM_BIN $HEADLESS -nEs -c '%g/author.*=/s/}//g' -c "wqa" -- "$OUTPUT_FILE"
# Insert {} around author
$VIM_BIN $HEADLESS -nEs -c '%g/author.*=/norm f=wi{$a F,i}' -c "wqa" -- "$OUTPUT_FILE"
# Remove double {{ }} from title
$VIM_BIN $HEADLESS -nEs -c '%g/title.*=/s/{//g' -c "wqa" -- "$OUTPUT_FILE"
$VIM_BIN $HEADLESS -nEs -c '%g/title.*=/s/}//g' -c "wqa" -- "$OUTPUT_FILE"
$VIM_BIN $HEADLESS -nEs -c '%g/title.*=/norm f=wi{$a F,i}' -c "wqa" -- "$OUTPUT_FILE"
# Line deletors
$VIM_BIN $HEADLESS -nEs -c '%g/type =/norm dd' -c "wqa" -- "$OUTPUT_FILE"
$VIM_BIN $HEADLESS -nEs -c '%g/doi =/norm dd' -c "wqa" -- "$OUTPUT_FILE"
$VIM_BIN $HEADLESS -nEs -c '%g/eprint =/norm dd' -c "wqa" -- "$OUTPUT_FILE"
$VIM_BIN $HEADLESS -nEs -c '%g/organization =/norm dd' -c "wqa" -- "$OUTPUT_FILE"
$VIM_BIN $HEADLESS -nEs -c '%g/publisher =/norm dd' -c "wqa" -- "$OUTPUT_FILE"
$VIM_BIN $HEADLESS -nEs -c '%g/issn =/norm dd' -c "wqa" -- "$OUTPUT_FILE"
$VIM_BIN $HEADLESS -nEs -c '%g/address =/norm dd' -c "wqa" -- "$OUTPUT_FILE"
$VIM_BIN $HEADLESS -nEs -c '%g/series =/norm dd' -c "wqa" -- "$OUTPUT_FILE"
$VIM_BIN $HEADLESS -nEs -c '%g/isbn =/norm dd' -c "wqa" -- "$OUTPUT_FILE"
$VIM_BIN $HEADLESS -nEs -c '%g/copyright =/norm dd' -c "wqa" -- "$OUTPUT_FILE"
# $VIM_BIN $HEADLESS -nEs -c '%g/url =/norm dd' -c "wqa" -- "$OUTPUT_FILE"
$VIM_BIN $HEADLESS -nEs -c '%g/onlinelibrary\.wiley\.com/norm dd' -c "wqa" -- "$OUTPUT_FILE"
$VIM_BIN $HEADLESS -nEs -c '%g/doi\.org/norm dd' -c "wqa" -- "$OUTPUT_FILE"
$VIM_BIN $HEADLESS -nEs -c '%g/mdpi\.com/norm dd' -c "wqa" -- "$OUTPUT_FILE"
$VIM_BIN $HEADLESS -nEs -c '%s/ě/e/g' -c "wqa" -- "$OUTPUT_FILE"
$VIM_BIN $HEADLESS -nEs -c '%s/š/s/g' -c "wqa" -- "$OUTPUT_FILE"
$VIM_BIN $HEADLESS -nEs -c '%s/č/c/g' -c "wqa" -- "$OUTPUT_FILE"
$VIM_BIN $HEADLESS -nEs -c '%s/ř/r/g' -c "wqa" -- "$OUTPUT_FILE"
$VIM_BIN $HEADLESS -nEs -c '%s/ž/z/g' -c "wqa" -- "$OUTPUT_FILE"
$VIM_BIN $HEADLESS -nEs -c '%s/ý/y/g' -c "wqa" -- "$OUTPUT_FILE"
$VIM_BIN $HEADLESS -nEs -c '%s/á/a/g' -c "wqa" -- "$OUTPUT_FILE"
$VIM_BIN $HEADLESS -nEs -c '%s/í/i/g' -c "wqa" -- "$OUTPUT_FILE"
$VIM_BIN $HEADLESS -nEs -c '%s/é/e/g' -c "wqa" -- "$OUTPUT_FILE"
$VIM_BIN $HEADLESS -nEs -c '%s/Ě/E/g' -c "wqa" -- "$OUTPUT_FILE"
$VIM_BIN $HEADLESS -nEs -c '%s/Š/S/g' -c "wqa" -- "$OUTPUT_FILE"
$VIM_BIN $HEADLESS -nEs -c '%s/Č/C/g' -c "wqa" -- "$OUTPUT_FILE"
$VIM_BIN $HEADLESS -nEs -c '%s/Ř/R/g' -c "wqa" -- "$OUTPUT_FILE"
$VIM_BIN $HEADLESS -nEs -c '%s/Ž/Z/g' -c "wqa" -- "$OUTPUT_FILE"
$VIM_BIN $HEADLESS -nEs -c '%s/Ý/Y/g' -c "wqa" -- "$OUTPUT_FILE"
$VIM_BIN $HEADLESS -nEs -c '%s/Á/A/g' -c "wqa" -- "$OUTPUT_FILE"
$VIM_BIN $HEADLESS -nEs -c '%s/Í/I/g' -c "wqa" -- "$OUTPUT_FILE"
$VIM_BIN $HEADLESS -nEs -c '%s/É/E/g' -c "wqa" -- "$OUTPUT_FILE"
$VIM_BIN $HEADLESS -nEs -c '%g/author.*=/s/\\n //g' -c "wqa" -- "$OUTPUT_FILE"
$VIM_BIN $HEADLESS -nEs -c '%g/author.*=/s/\\v //g' -c "wqa" -- "$OUTPUT_FILE"
$VIM_BIN $HEADLESS -nEs -c '%g/author.*=/s/\\n//g' -c "wqa" -- "$OUTPUT_FILE"
$VIM_BIN $HEADLESS -nEs -c '%g/author.*=/s/\\v//g' -c "wqa" -- "$OUTPUT_FILE"
$VIM_BIN $HEADLESS -nEs -c "%g/author.*=/s/\\\'//g" -c "wqa" -- "$OUTPUT_FILE"
$VIM_BIN $HEADLESS -nEs -c "%g/author.*=/s/\\\\//g" -c "wqa" -- "$OUTPUT_FILE"
$VIM_BIN $HEADLESS -nEs -c '%g/title.*=/s/\\n//g' -c "wqa" -- "$OUTPUT_FILE"
$VIM_BIN $HEADLESS -nEs -c '%g/title.*=/s/\\v//g' -c "wqa" -- "$OUTPUT_FILE"
$VIM_BIN $HEADLESS -nEs -c "%g/title.*=/s/\\\'//g" -c "wqa" -- "$OUTPUT_FILE"
$VIM_BIN $HEADLESS -nEs -c "%g/title.*=/s/\\\\//g" -c "wqa" -- "$OUTPUT_FILE"
# Title field correction
$VIM_BIN $HEADLESS -nEs -c '%g/title = {/norm f{a{$F}i}' -c "wqa" -- "$OUTPUT_FILE" # add {} brackets around title
# Month field correction
$VIM_BIN $HEADLESS -nEs -c '%g/month = {/norm f{x$F}x' -c "wqa" -- "$OUTPUT_FILE" # delete {} brackets around the month
$VIM_BIN $HEADLESS -nEs -c '%g/month = /norm Vu' -c "wqa" -- "$OUTPUT_FILE" # lowercase
$VIM_BIN $HEADLESS -nEs -c '%g/month = /s/january/1' -c "wqa" -- "$OUTPUT_FILE"
$VIM_BIN $HEADLESS -nEs -c '%g/month = /s/february/2' -c "wqa" -- "$OUTPUT_FILE"
$VIM_BIN $HEADLESS -nEs -c '%g/month = /s/march/3' -c "wqa" -- "$OUTPUT_FILE"
$VIM_BIN $HEADLESS -nEs -c '%g/month = /s/april/4' -c "wqa" -- "$OUTPUT_FILE"
$VIM_BIN $HEADLESS -nEs -c '%g/month = /s/may/5' -c "wqa" -- "$OUTPUT_FILE"
$VIM_BIN $HEADLESS -nEs -c '%g/month = /s/june/6' -c "wqa" -- "$OUTPUT_FILE"
$VIM_BIN $HEADLESS -nEs -c '%g/month = /s/july/7' -c "wqa" -- "$OUTPUT_FILE"
$VIM_BIN $HEADLESS -nEs -c '%g/month = /s/august/8' -c "wqa" -- "$OUTPUT_FILE"
$VIM_BIN $HEADLESS -nEs -c '%g/month = /s/september/9' -c "wqa" -- "$OUTPUT_FILE"
$VIM_BIN $HEADLESS -nEs -c '%g/month = /s/october/10' -c "wqa" -- "$OUTPUT_FILE"
$VIM_BIN $HEADLESS -nEs -c '%g/month = /s/november/11' -c "wqa" -- "$OUTPUT_FILE"
$VIM_BIN $HEADLESS -nEs -c '%g/month = /s/december/12' -c "wqa" -- "$OUTPUT_FILE"
# Conference shortening
$VIM_BIN $HEADLESS -nEs -c "set ignorecase" -c "%s/[0-9]*\s*\w*\s*Advances in Neural Information Processing Systems/NIPS/g" -c "wqa" -- "$OUTPUT_FILE"
$VIM_BIN $HEADLESS -nEs -c "set ignorecase" -c "%s/[0-9]*\s*\w*\s*Third International Conference on 3-D Digital Imaging and Modeling/3DIM/g" -c "wqa" -- "$OUTPUT_FILE"
$VIM_BIN $HEADLESS -nEs -c "set ignorecase" -c "%s/[0-9]*\s*\w*\s*Fourth International Conference on 3-D Digital Imaging and Modeling/3DIM/g" -c "wqa" -- "$OUTPUT_FILE"
$VIM_BIN $HEADLESS -nEs -c "set ignorecase" -c "%s/[0-9]*\s*\w*\s*Proceedings of the IEEE COnference on Computer Vision and Pattern Recognition/IEEE\/CVF CVPR/g" -c "wqa" -- "$OUTPUT_FILE"
$VIM_BIN $HEADLESS -nEs -c "set ignorecase" -c "%s/[0-9]*\s*\w*\s*In 2018//g" -c "wqa" -- "$OUTPUT_FILE"
$VIM_BIN $HEADLESS -nEs -c "set ignorecase" -c "%s/[0-9]*\s*\w*\s*in 2018//g" -c "wqa" -- "$OUTPUT_FILE"
$VIM_BIN $HEADLESS -nEs -c "set ignorecase" -c "%s/[0-9]*\s*\w*\s*in 2012//g" -c "wqa" -- "$OUTPUT_FILE"
$VIM_BIN $HEADLESS -nEs -c "set ignorecase" -c "%s/[0-9]*\s*\w*\s*International Journal of Geo-Information/JGI/g" -c "wqa" -- "$OUTPUT_FILE"
# $VIM_BIN $HEADLESS -nEs -c "set ignorecase" -c "%s/[0-9]*\s*\w*\s*IEEE VGTC Conference on Point-Based Graphics/IEEE VGTC PBG//g" -c "wqa" -- "$OUTPUT_FILE"
$VIM_BIN $HEADLESS -nEs -c "set ignorecase" -c "%s/[0-9]*\s*International Conference on Unmanned Aircraft Systems (ICUAS)/ICUAS/g" -c "wqa" -- "$OUTPUT_FILE"
$VIM_BIN $HEADLESS -nEs -c "set ignorecase" -c "%s/[0-9]*\s*\w*\s*IEEE European Conference on Mobile Robots (ECMR)/IEEE ECMR/g" -c "wqa" -- "$OUTPUT_FILE"
$VIM_BIN $HEADLESS -nEs -c "set ignorecase" -c "%s/[0-9]*\s*\w*\s*IEEE International Conference on Emerging Technologies and Factory Automation (ETFA)/IEEE ETFA/g" -c "wqa" -- "$OUTPUT_FILE"
$VIM_BIN $HEADLESS -nEs -c "set ignorecase" -c "%s/[0-9]*\s*IEEE\/RSJ International Conference on Intelligent Robots and Systems (IROS)/IEEE\/RSJ IROS/g" -c "wqa" -- "$OUTPUT_FILE"
$VIM_BIN $HEADLESS -nEs -c "set ignorecase" -c "%s/[0-9]*\s*IEEE\/RSJ International Conference on Intelligent Robots and Systems/IEEE\/RSJ IROS/g" -c "wqa" -- "$OUTPUT_FILE"
$VIM_BIN $HEADLESS -nEs -c "set ignorecase" -c "%s/[0-9]*\s*IEEE Intelligent Transportation Systems Conference/IEEE ITSC/g" -c "wqa" -- "$OUTPUT_FILE"
$VIM_BIN $HEADLESS -nEs -c "set ignorecase" -c "%s/[0-9]*\s*IEEE\/CVF International Conference on Computer Vision (ICCV)/IEEE\/CVF ICCV/g" -c "wqa" -- "$OUTPUT_FILE"
$VIM_BIN $HEADLESS -nEs -c "set ignorecase" -c "%s/[0-9]*\s*IEEE\/CVF Conference on Computer Vision and Pattern Recognition (CVPR)/IEEE\/CVF CVPR/g" -c "wqa" -- "$OUTPUT_FILE"
$VIM_BIN $HEADLESS -nEs -c "set ignorecase" -c "%s/[0-9]*\s*IEEE Conference on Computer Vision and Pattern Recognition/IEEE CVPR/g" -c "wqa" -- "$OUTPUT_FILE"
$VIM_BIN $HEADLESS -nEs -c "set ignorecase" -c "%s/[0-9]*\s*IEEE International Conference on Real-time Computing and Robotics (RCAR)/IEEE RCAR/g" -c "wqa" -- "$OUTPUT_FILE"
$VIM_BIN $HEADLESS -nEs -c "set ignorecase" -c "%s/Modelling and Simulation for Autonomous Systems (MESAS)/MESAS/g" -c "wqa" -- "$OUTPUT_FILE"
$VIM_BIN $HEADLESS -nEs -c "set ignorecase" -c "%s/IEEE International Conference on Control, Automation, Robotics and Vision (ICARCV)/IEEE ICARCV/g" -c "wqa" -- "$OUTPUT_FILE"
$VIM_BIN $HEADLESS -nEs -c "set ignorecase" -c "%s/[0-9]*\s*\w*\s*International Conference on Advanced Robotics (ICAR)/ICAR/g" -c "wqa" -- "$OUTPUT_FILE"
$VIM_BIN $HEADLESS -nEs -c "set ignorecase" -c "%s/[0-9]*\s*\w*\s*International Conference on Ubiquitous Robots and Ambient Intelligence (URAI)/URAI/g" -c "wqa" -- "$OUTPUT_FILE"
$VIM_BIN $HEADLESS -nEs -c "set ignorecase" -c "%s/2018 ACM\/IEEE 9th International Conference on Cyber-Physical Systems (ICCPS)/ACM\/IEEE ICCPS/g" -c "wqa" -- "$OUTPUT_FILE"
$VIM_BIN $HEADLESS -nEs -c "set ignorecase" -c "%s/2016 8th International Conference on Modelling, Identification and Control (ICMIC)/IEEE ICMIC/g" -c "wqa" -- "$OUTPUT_FILE"
$VIM_BIN $HEADLESS -nEs -c "set ignorecase" -c "%s/Australasian Conference on Robotics and Automation (ACRA)/ACRA/g" -c "wqa" -- "$OUTPUT_FILE"
$VIM_BIN $HEADLESS -nEs -c "set ignorecase" -c "%s/Robotics and Automation Letters (RAL)/Robotics and Automation Letters/g" -c "wqa" -- "$OUTPUT_FILE"
$VIM_BIN $HEADLESS -nEs -c "set ignorecase" -c "%s/Robotics and Automation Letters/RA-L/g" -c "wqa" -- "$OUTPUT_FILE"
$VIM_BIN $HEADLESS -nEs -c "set ignorecase" -c "%s/Robotics and Automation Magazine/RA-M/g" -c "wqa" -- "$OUTPUT_FILE"
$VIM_BIN $HEADLESS -nEs -c "set ignorecase" -c "%s/[0-9]*\s*\w*\s*International Conference on Robotics and Automation (ICRA)/IEEE ICRA/g" -c "wqa" -- "$OUTPUT_FILE"
$VIM_BIN $HEADLESS -nEs -c "set ignorecase" -c "%s/[0-9]*\s*\w*\s*IEEE International Conference on Robotics and Automation/IEEE ICRA/g" -c "wqa" -- "$OUTPUT_FILE"
$VIM_BIN $HEADLESS -nEs -c "set ignorecase" -c "%s/\(IEEE\)*\s*[0-9]*\s*\w*\s*Conference on Decision and Control (CDC)/IEEE CDC/g" -c "wqa" -- "$OUTPUT_FILE"
$VIM_BIN $HEADLESS -nEs -c "set ignorecase" -c "%s/[0-9]*\s*\(IEEE\)*\s*\w*\s*International Conference on Systems, Man, and Cybernetics (SMC)/IEEE SMC/g" -c "wqa" -- "$OUTPUT_FILE"
$VIM_BIN $HEADLESS -nEs -c "set ignorecase" -c "%s/[0-9]*\s*\(IEEE\)*\s*\w*\s*International Conference on Methods and Models in Automation and Robotics (MMAR)/IEEE MMAR/g" -c "wqa" -- "$OUTPUT_FILE"
$VIM_BIN $HEADLESS -nEs -c "set ignorecase" -c "%s/[0-9]*\(th\)*\s*\(IEEE\)*\s*\w*\s*International Conference on Automation Science and Engineering (CASE)/IEEE CASE/g" -c "wqa" -- "$OUTPUT_FILE"
$VIM_BIN $HEADLESS -nEs -c "set ignorecase" -c "%s/[0-9]*\s*\(IEEE\)*\s*\w*\s*International Symposium on Safety, Security and Rescue Robotics (SSRR)/IEEE SSRR/g" -c "wqa" -- "$OUTPUT_FILE"
$VIM_BIN $HEADLESS -nEs -c "set ignorecase" -c "%s/[0-9]*\s*\(IEEE\)*\s*\w*\s*International Conference on Unmanned Systems (ICUS)/IEEE ICUS/g" -c "wqa" -- "$OUTPUT_FILE"
# Bold name
$VIM_BIN $HEADLESS -nEs -c '%s/Petracek, Pavel/P. Petracek/g' -c "wqa" -- "$OUTPUT_FILE"
$VIM_BIN $HEADLESS -nEs -c '%s/Petracek, P\./P. Petracek/g' -c "wqa" -- "$OUTPUT_FILE"
$VIM_BIN $HEADLESS -nEs -c '%s/Pavel Petracek/P. Petracek/g' -c "wqa" -- "$OUTPUT_FILE"
$VIM_BIN $HEADLESS -nEs -c '%s/P\. Petracek/\\textbf\{P. Petracek\}/g' -c "wqa" -- "$OUTPUT_FILE"
# Bold note
$VIM_BIN $HEADLESS -nEs -c '%g/note = {/norm f{a\textbf{$F}i}' -c "wqa" -- "$OUTPUT_FILE"