Files
elwig-misc/tt/sum.sh
2023-05-27 23:39:57 +02:00

14 lines
328 B
Bash
Executable File

#!/bin/bash
function get_sum() {
cut -d"," -f4 "$1.csv" | tail -n+2 | paste -sd+ | bc
}
hil=$(get_sum "HIL")
ste=$(get_sum "STE")
total=$(echo "$hil+$ste" | bc)
hil_perc=$(echo "$hil*100/$total" | bc)
ste_perc=$(echo "$ste*100/$total" | bc)
echo -e "HIL:\t$hil\t(${hil_perc}%)\nSTE:\t$ste\t(${ste_perc}%)\nTotal:\t$total"