SD 212 Spring 2023 / Homeworks


This is the archived website of SD 212 from the Spring 2023 semester. Feel free to browse around; you may also find more recent offerings at my teaching page.

hw06: Reading about pipes

  • Due before the beginning of class on Monday, January 23

Today’s homework asks you to do a few different things, and then fill in another wonderful markdown file to show what you’ve done.

  1. Sign up for the info challenge.

    As we mentioned in class, every SD212 student will be participating in the UMD/USNA Info Challenge, which is a (hopefully) fun and useful way to connect our data science skills to real-world datasets and to work with external mentors.

    Note that you will all be assigned to teams within SD212, after signing up.

    Fill in the Google form to sign up if you haven’t already.

    Answer “yes” to this problem to indicate that you’ve completed and submitted that form.

  • (Optional) Install some extra command-line tools in WSL

    Most of the command line tools we are using come pre-installed with every version of Linux. But a few are not. They are available on the lab machines and csmidn, but if you want them on your laptop too, then open a WSL/Ubuntu terminal and run these commands. (When you are asked, enter your WSL/Ubuntu password that you chose):

    sudo apt update
    sudo apt install -y jq moreutils bsdmainutils bat tree cowsay csvkit tldr mlocate aspell bc diction groff
  1. Read TLCL Chapter 6 “Redirection”

    Answer “yes” to indicate that you did the reading.

  2. What is “standard error”?

    1. An error message indicating a program does not work properly
    2. A special location (default goes to the screen) where status messages are printed
    3. A file in the directory /var/log where a program’s error messages are stored
    4. A terminal that is used for debugging when a program crashes
  3. Assume congress.txt is a file that contains information on elected representatives like

    firstname,lastname,state,party

    What would the following pipeline do?

    cat congress.txt | cut -d',' -f3 | sort | uniq | wc -l
    1. Get the number of different states in the file
    2. Get the number of felines that have been elected to office
    3. Print out all party affiliations in sorted order
    4. Show how many members of each party are represented

Submit command

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

submit -c=sd212 -p=hw06 hw06.md 
club -csd212 -phw06 hw06.md
Download the file hw06.md to fill in and submit for this homework