Project Overview
Part of the Bash Scripting section of Coddy's Terminal journey. Lesson 31 of 39.
Challenge
EasyOver 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.
- Look at the data first. Run
head -n 3 sales.csvto see the header and the first two sales. - Run
wc -l sales.csv. It prints13 sales.csv: one header line and 12 sales. - 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
All lessons in Bash Scripting
1Arguments And Exit Codes
Script ArgumentsAll The ArgumentsExit CodesChecking ArgumentsRecap - Unit Converter4Strings And Arrays
Slicing StringsTrimming And ReplacingDefault ValuesArraysReading Files Line By LineRecap - CSV Report7Sales Report Project
Project OverviewCheck The Input FileTotals Per RegionSort And FormatA Top OptionSave The ReportPractice on your own: Terminal playground