Menu
CoddyTech

Project Overview

Part of the Bash Scripting section of Coddy's Terminal journey. Lesson 31 of 39.

challenge icon

Challenge

Easy

Over the next six steps you build report.sh, a script that turns a CSV file of sales into a short report. sales.csv holds one sale per line: date,region,product,amount. A second file, q2.csv, has the same columns and other numbers, and your script must work for both.

  1. Look at the data first. Run head -n 3 sales.csv to see the header and the first two sales.
  2. Run wc -l sales.csv. It prints 13 sales.csv: one header line and 12 sales.
  3. Open report.sh. Below the comment, add a line that prints the title === Sales Report === (three equals signs, a space, the words, a space, three equals signs). Save the file.

Try it: run bash report.sh. It prints:

=== Sales Report ===

Later steps keep this title as the first line of the report.

Try it yourself

Terminal

All lessons in Bash Scripting

Practice on your own: Terminal playground