-
Notifications
You must be signed in to change notification settings - Fork 1
/
do.sh
executable file
·62 lines (48 loc) · 2.74 KB
/
do.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
#! /bin/bash
ALL="publications.bib"
MAIN="src/main.bib"
CLEANED="src/.main.bib"
echo "[INFO] Cleaning $MAIN -> $CLEANED"
bibtool -r bibtool/sort_fld.rsc -r bibtool/main.rsc -r biblatex $MAIN > $CLEANED
mv $CLEANED $MAIN
echo "[INFO] Splitting $MAIN into files"
bibtool -r bibtool/sort_fld.rsc -r bibtool/main.rsc '--select{@InProceedings}' $MAIN > .papers
bibtool -r bibtool/sort_fld.rsc -r bibtool/main.rsc '--select{keywords "workshop"}' .papers > .workshops
bibtool -r bibtool/sort_fld.rsc -r bibtool/main.rsc '--select{@Article}' $MAIN > .journals
bibtool -r bibtool/sort_fld.rsc -r bibtool/main.rsc '--select{@TechReport}' $MAIN > .reports
bibtool -r bibtool/sort_fld.rsc -r bibtool/main.rsc '--select{@Unpublished}' $MAIN > .talks
bibtool -r bibtool/sort_fld.rsc -r bibtool/main.rsc '--select{@PhdThesis}' $MAIN > .dissertations
bibtool -r bibtool/sort_fld.rsc -r bibtool/main.rsc -r biblatex '--select{@Thesis}' $MAIN > .theses
echo "[INFO] Generating README.md file"
rm README.md
echo '# Publications' >> README.md
echo " * $(grep '^@' .papers | wc -l | tr -d '[:space:]') conference papers" >> README.md
echo " * $(grep '^@' .workshops | wc -l | tr -d '[:space:]') workshop papers" >> README.md
echo " * $(grep '^@' .journals | wc -l | tr -d '[:space:]') journal papers" >> README.md
echo " * $(grep '^@' .reports | wc -l | tr -d '[:space:]') technical reports" >> README.md
echo " * $(grep '^@' .talks | wc -l | tr -d '[:space:]') talks" >> README.md
echo " * $(grep '^@' .dissertations | wc -l | tr -d '[:space:]') dissertations" >> README.md
echo " * $(grep '^@' .theses | wc -l | tr -d '[:space:]') theses" >> README.md
echo "" >> README.md
echo "Updated on $(date)" >> README.md
echo "[INFO] Updating individual files"
bibtool -r bibtool/sort_fld.rsc -r bibtool/main.rsc -r bibtool/papers.rsc '--select.non{keywords "workshop"}' .papers > papers.bib
rm .papers
bibtool -r bibtool/sort_fld.rsc -r bibtool/main.rsc -r bibtool/journals.rsc .journals > journals.bib
rm .journals
bibtool -r bibtool/sort_fld.rsc -r bibtool/main.rsc -r bibtool/reports.rsc .reports > reports.bib
rm .reports
bibtool -r bibtool/sort_fld.rsc -r bibtool/main.rsc -r bibtool/workshops.rsc .workshops > workshops.bib
rm .workshops
bibtool -r bibtool/sort_fld.rsc -r bibtool/main.rsc -r bibtool/talks.rsc .talks > talks.bib
rm .talks
bibtool -r bibtool/sort_fld.rsc -r bibtool/main.rsc -r bibtool/dissertations.rsc .dissertations > dissertations.bib
rm .dissertations
bibtool -r bibtool/sort_fld.rsc -r bibtool/main.rsc -r biblatex .theses > theses.bib
rm .theses
echo "[INFO] Re-generating $ALL"
rm -f $ALL $ALL.tmp
cat {papers,journals,reports,workshops,talks,dissertations,theses}.bib > $ALL.tmp
bibtool -r bibtool/sort_fld.rsc -r bibtool/main.rsc -r biblatex $ALL.tmp > $ALL
rm $ALL.tmp
source ck.sh