SD 212 Spring 2026 / Homeworks


hw14: Eagles csvs

  • Due before the beginning of class on Wednesday, March 4

Getting started

Run git pull in your sd212 directory. You should see a new folder for this HW, with a few csv files for testing and an empty bash script eagles.sh for you to complete.

Your task

Write a bash script eagles.sh that displays the header lines of any csv files in the current directory that mention an eagle.

Specifically, your eagles.sh script should look at any files in the current directory whose filename ends in .csv, and if any such file has the string “eagle” in it anywhere (case insensitive), display a line containing the filename, a colon, and then the first line of that file.

For example, if your directory contains the three example files birds.csv, babies.csv, and superbowl.csv, then running your program should result in:

roche@ubuntu$ bash eagles.sh
birds.csv: EnglishName,Species,Lifespan
superbowl.csv: Date,SB,Winner,Winner Pts,Loser,Loser Pts,MVP,Stadium,City,State

Hints:

  • Try to use a for loop with an if statement inside the loop.
  • You might want to review this previous HW
  • Remember your bash commands and use them well! Look over this list if you need to remember which ones we learned about.

Submit command

To submit files for this homework, run one of these commands:

submit -c=sd212 -p=hw14 eagles.sh
club -csd212 -phw14 eagles.sh