Commit fac70d59 authored by vagrant's avatar vagrant

working on problem 5

parent 8f4e0d58
#!/bin/bash
timesheet="$(pwd)/timesheet.csv"
#sort timesheet by customer
#sum of each customer
currentCustomer=""
sum=0
#infinite loop rn
sort -t"," -k5 $timeshet | while read -r line
do
customer=$(echo $line | cut -d"," -f5)
billable=$(echo $line | cut -d"," -f7)
hours=$(echo $line | cut -d"," -f8)
echo $customer
if [$customer != $currentCustomer]
then
#echo $currentCustomer
#echo $sum
currentcustomer=$customer
sum=0
fi
if [$billable == "Y"]
then
sum=$((sum + hours))
fi
done
#final print sum
echo $currentCustomer
echo $sum
This source diff could not be displayed because it is too large. You can view the blob instead.
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