Commit 419f66b1 authored by Julius Wu's avatar Julius Wu

fix question 5

parent 5de19679
#!/bin/bash
echo "Customer: Hours"
awk -F, '{
arr[$5]+=$8
}
END{
for(key in arr) print key , arr[key]}' timesheet.csv | sort -u
cat timesheet.csv | awk -F"," ' {if (($7 == "Y")) print; } ' | cut -d ',' -f5,7-8
\ No newline at end of file
declare -i totalhours=0
while read LINE
do
billFlag=$(echo $LINE | awk -F, '{print $7}')
hours=$(echo $LINE | awk -F, '{print $8}')
[[ $billFlag == "Y" ]] && totalhours=$(( $totalhours + $hours ))
done < ./timesheet.csv
echo "Total: $totalhours"
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment