From 5bc7c4af89c40fbee2769e86fbc69d0704a7e653 Mon Sep 17 00:00:00 2001 From: Trey Blancher Date: Wed, 16 Sep 2020 17:48:58 -0400 Subject: [PATCH] Added running subtotal to do_process.sh --- do_process.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/do_process.sh b/do_process.sh index 6c51cc6..a7330a4 100755 --- a/do_process.sh +++ b/do_process.sh @@ -54,9 +54,12 @@ if [[ -f ${DATE} ]]; then echo echo WHOLE="" + subtotal=0 for pattern in "${KEYS[@]}"; do #echo "pattern=${pattern}" >&2 $grep -- "\[${pattern}\]" ${DATE} | timetracker + subtotal=$(bc <<< "scale=2; ${subtotal} + $($grep -- "\[${pattern}\]" ${DATE} | timetracker | $grep "Section" | $grep -Po '\d+\.\d+hrs' | tr -d '[hrs]')") + printf "Subtotal: %3.2fhrs\n" ${subtotal} echo if [[ "${WHOLE}x" == "x" ]]; then WHOLE="${pattern}"