Data from Anywhere

CSV files, JSON, the web and dates: the data real tools work with.

Updated

Data

  1. CSV Files in Bash, and Their Limits (Journeyman): A CSV file is a table saved as text: while IFS=, read -r reads it a row at a time into named variables, awk -F, picks and totals its columns, and a comma inside a quoted value breaks both.
  2. JSON with jq (Journeyman): jq reads JSON, the labeled data that web APIs and cloud tools answer with: dots follow the labels in, .[] goes through every item in a list, select keeps the items you want, and -r prints plain lines a bash loop can read.

The Web

  1. Talking to the Web: curl (Journeyman): curl fetches whatever is at a web address, from the terminal or a script: it prints a page, saves a download with -o or -O, asks a web API for JSON, shows the status code with -w, and with -f fails on an error instead of saving the error page.

Time

  1. Dates and Times (Journeyman): date followed by + and a pattern prints a date in the shape you need, such as date +%F for 2026-11-09; date -d works out other days, such as 7 days ago; date +%s counts seconds, for timing a job; and a Mac's date uses -v instead of -d.

Exercise: Today's Weather Report

  1. Exercise: Today's Weather Report (Journeyman): Write two small tools, a script that turns a saved weather forecast into a short daily report with jq and date, and one that downloads a fresh forecast with curl without ever losing the saved one, then let a check script tell you what's done.