Lessons

AWK · Easy

AWK · Easy. Ten lessons. Open-book quizzes. Lesson 1 free.

10 lessons · The Host · Lesson 1 free

Pass all ten lessons for the certificate. Sample · Claim

  1. Multidimensional arrays and SUBSEP

    Lesson 1 · On the house

    Multidimensional arrays and SUBSEP

    Simulate matrices with a[i,j], understand SUBSEP, split compound keys, and walk rows and columns safely.

  2. Sorted traversal with asort and asorti

    Lesson 2

    Sorted traversal with asort and asorti

    Sort array values with asort, sort keys with asorti, keep the original map, and print frequency tables in a stable order.

  3. Advanced regex: match, gensub and word boundaries

    Lesson 3

    Advanced regex: match, gensub and word boundaries

    Capture groups with match's array, rewrite with gensub, use word-boundary anchors, and extract structured pieces from a line.

  4. Bit operations and switch statements

    Lesson 4

    Bit operations and switch statements

    Mask and shift with and, or, xor, lshift and rshift, invert with compl, and branch with gawk's switch/case.

  5. Indirect function calls with @

    Lesson 5

    Indirect function calls with @

    Call a function by name with @fname(args), build dispatch tables, and choose handlers at run time.

  6. ARGV and ARGC: choosing files mid-run

    Lesson 6

    ARGV and ARGC: choosing files mid-run

    Set ARGV and ARGC in BEGIN, skip a file by clearing ARGV[i], jump ahead with nextfile, and read a list of paths.

  7. ENVIRON and PROCINFO

    Lesson 7

    ENVIRON and PROCINFO

    Read environment variables with ENVIRON, inspect gawk state through PROCINFO, and branch on version or FS mode.

  8. FPAT and FIELDWIDTHS for structured fields

    Lesson 8

    FPAT and FIELDWIDTHS for structured fields

    Parse CSV-ish lines with FPAT, read fixed-width records with FIELDWIDTHS, and know which mode PROCINFO reports.

  9. Two-way pipes and getline from commands

    Lesson 9

    Two-way pipes and getline from commands

    Feed a command with |&, read its output back, close each direction, and fall back to ordinary command getline.

  10. Utility: sorted frequency report

    Lesson 10

    Utility: sorted frequency report

    Build a reusable word-frequency tool with FPAT-free splitting, asorti, ARGV sample input, and aligned printf output.

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.

All lessons