Commit 53531f2f authored by Shanelle Valencia's avatar Shanelle Valencia

Update 5-generateReport

parent 6082ebca
...@@ -2,13 +2,30 @@ ...@@ -2,13 +2,30 @@
while read LINE #while read LINE
do #do
totalhours=0 # totalhours=0
awk -F"," '{ # awk -F"," '{
# if (($7 == "Y"))
# arr[$5] += $8;
# totalhours=totalhours + $8;
# }
# END{for(key in arr)
# { print key, arr[key] }
# { totalhours += arr[key] }
# { print "Total: " totalhours }
# }'
#done < <(cat ./timesheet.csv | sort -k5 )
# don't need whle loop - redundant
awk -F"," '{
if (($7 == "Y")) if (($7 == "Y"))
arr[$5] += $8; arr[$5] += $8;
totalhours=totalhours + $8; totalhours=totalhours + $8;
...@@ -17,10 +34,7 @@ do ...@@ -17,10 +34,7 @@ do
{ print key, arr[key] } { print key, arr[key] }
{ totalhours += arr[key] } { totalhours += arr[key] }
{ print "Total: " totalhours } { print "Total: " totalhours }
}' }' timesheet.csv
done < <(cat ./timesheet.csv | sort -k5 )
......
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