-
Notifications
You must be signed in to change notification settings - Fork 0
/
stats.sh
102 lines (70 loc) · 2.22 KB
/
stats.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
#!/bin/bash
# ss11mik
# 2023
input=$1
parse () {
studenti=$(grep $input -we "student $1" | wc -l)
echo " studenti:" $studenti
if [ $studenti -ne 0 ]; then
studentky=$(grep $input -we "student $1" | grep -e "á " | wc -l)
studentkyProcent=$(bc <<< "scale=2; $studentky * 100 / $studenti")
echo " studentky: $studentky ($studentkyProcent %)"
# has Bc., but not Ing. nor Mgr. in name
studentiBc=$(grep $input -we "student $1" | grep "Bc\." | grep -v -e "Ing\." -e "Mgr\." | wc -l)
echo " studenti s Bc.:" $studentiBc
if [ $studentiBc -ne 0 ]; then
studentkyBc=$(grep $input -we "student $1" | grep "Bc\." | grep -v -e "Ing\." -e "Mgr\." | grep -e "á " | wc -l)
studentkyBcProcent=$(bc <<< "scale=2; $studentkyBc * 100 / $studentiBc")
echo " studentky s Bc.: $studentkyBc ($studentkyBcProcent %)"
fi
fi
zamestnanci=$(grep $input -we "zaměstnanec $1" | wc -l)
echo " zaměstnanci:" $zamestnanci
if [ $zamestnanci -ne 0 ]; then
zamestnankyne=$(grep $input -we "zaměstnanec $1" | grep -e "á " | wc -l)
zamestnankyneProcent=$(bc <<< "scale=2; $zamestnankyne * 100 / $zamestnanci")
echo " zaměstnankyně: $zamestnankyne ($zamestnankyneProcent %)"
echo -n " profesoři: "
# in the data, there is found both "Prof." and "prof."
grep $input -we "zaměstnanec $1" | grep -we "Prof\." -we "prof\." | wc -l
echo " studenti/zaměstnanci:" $(bc <<< "scale=2; $studenti / $zamestnanci")
fi
echo -n " externisté: "
grep $input -we "externista $1" | wc -l
}
faculty () {
echo ""
echo "$1:"
echo -n " celkem: "
grep $input -we "$1" | wc -l
parse $1
}
whole_vut () {
echo "Celé VUT:"
echo -n " celkem: "
cat $input | wc -l
parse "*"
echo -n " bez role: "
grep -E "\- $" $input | wc -l
}
stats () {
faculty FIT
faculty FEKT
faculty FSI
faculty FCH
faculty FA
faculty FAST
faculty FaVU
faculty FP
echo ""
faculty CESA
faculty ÚSI
faculty ICV
faculty CEITEC
echo ""
faculty KAMB # Koleje a menzy
faculty RE # rektorat
echo ""
whole_vut
}
stats