Totals per Group
Each line of sales.csv is a department and an amount, like tools,120. Print one line per department with the department, a space and the sum of its amounts, in alphabetical order of department.
Example 1
sales.csv
tools,120 toys,30 tools,5 books,60 toys,1
prints
books 60 tools 125 toys 31
Constraints
- 1 to 20 lines
- Amounts are whole numbers
Write it in your browser, against the clock. The model script, with a note on each command it uses, comes after.
More Bash problems
- Word Count TableHard
- Count the LinesBeginner
- Count the WordsBeginner
- First Three LinesBeginner
- Hello, NameBeginner
- How Many ErrorsBeginner
- Into a New FolderBeginner
- Last Two LinesBeginner