How AWK Works
AWK =
A
ho,
W
einberger,
K
ernighan
AWK Script
BEGIN { print "=== START ===" } { print NR ": " $1 " + " $2 " = " ($1 + $2) } END { print "=== END ===" }
▶ Run AWK Animation
Reset
Key Concepts
Line-by-line
: AWK reads one record (line) at a time
Fields
: $1, $2, $3... (split by whitespace or FS)
Built-ins
: NR (line number), NF (fields count), $0 (whole line)
Pattern { Action }
: If pattern matches → do action
BEGIN / END
: Run before/after processing all lines
Input Data
10 20 5 15 30 7 12 8
Processing Animation
Output