Hands-on task
This task is step 16 of the course “Text in the terminal: grep, sed, awk”
Expenses by department from a CSV
/root/expenses.csv has lines department,amount — each purchase separately, departments repeat in random order. Compute the total for each department and write lines department total (separated by a space) to /root/by_dept.txt. Line order doesn't matter.
Reference:awk
What you'll practise:
- awk
- -F delimiter
- associative array
- grouping
- END block