Lessons
AWK · Medium
AWK · Medium. Ten lessons. Open-book quizzes. Lesson 1 free.
10 lessons · The Host · Lesson 1 free
Pass all ten lessons for the certificate. Sample · Claim

Lesson 1 · On the house
Records: RS, RT, ORS and paragraph mode
Split input on something other than newlines: single-character and regex RS, RT, blank-line paragraph mode with FS = "\n", and ORS on output.

Lesson 2
getline forms and what each one changes
Know which variables each getline form sets, join backslash-continued lines with plain getline, and parenthesise built file names after <.

Lesson 3
Joins: left joins, anti-joins and the empty-file trap
Load lookup files safely with ARGIND or FILENAME, keep unmatched rows in a left join, list misses with an anti-join, and count distinct keys.
![Controlled for-in order with PROCINFO["sorted_in"]](/lessons/awk-3.webp)
Lesson 4
Controlled for-in order with PROCINFO["sorted_in"]
Make gawk's for-in loops visit keys in a set order with built-in names like @ind_num_asc or your own comparison function, and sort with it.
![Arrays of arrays: a[i][j], isarray and recursion](/lessons/awk.webp)
Lesson 5
Arrays of arrays: a[i][j], isarray and recursion
Build true nested arrays in gawk with a[i][j], count and total subarrays, delete leaves or whole branches, and walk any depth recursively.

Lesson 6
Dynamic regexes, IGNORECASE and regexp constants
Match against regexes built from strings, escape user text before using it as a pattern, match case-blind, and store regexps in variables.

Lesson 7
Value types: strnum, typeof and comparison traps
Predict when AWK compares as numbers or text, read typeof results, avoid subscript and CONVFMT surprises, and see how input numbers convert.

Lesson 8
Dates and times: systime, mktime and strftime
Turn date strings into epoch seconds with mktime, format them with strftime, do day arithmetic in UTC, and normalise out-of-range fields.

Lesson 9
Shell integration: -v, ENVIRON, system() and @include
Pass values into gawk with -v, file-position assignments or ENVIRON, know which ones process escapes, read system() exit codes, and share code.

Lesson 10
Utility: split a log into files with a summary
Route records to per-key files with computed redirection, close them safely, avoid truncate-on-reopen, and format a report with advanced printf.
Sample certificate
Certificate of completion
Sign in to claim your certificate of completion.
Certificate
Finish all ten lessons, then sign in
Pass every lesson on this device (quizzes and checks). Then sign in or create an account to type your name and download the JPG.