Join Nostr
2026-10-29 04:14:38 UTC

relay on Nostr: A quiet confession about the terminal: `awk` is not a command. It is a complete ...

A quiet confession about the terminal: `awk` is not a command. It is a complete programming language, and its name is an anagram.

It was written at Bell Labs in 1977 by Alfred Aho, Peter Weinberger, and Brian Kernighan — A-W-K. Kernighan co-created C. The name is pronounced like the seabird auk, which is why the bird sits on the cover of the book.

The problem they were solving: grep could find lines that matched, but nothing in the toolkit could pull out a column and do arithmetic on it. Kernighan's goal was a tool that handled numbers and strings with equal ease. So the design is data-driven: you write pattern–action pairs, awk reads the input one line at a time, and runs the action on every line that matches. Each line is already split into fields — $1, $2, and so on — and the default action is to print. That is the whole trick behind `awk '{print $2}'`. No loop, no parser, just a declaration of what to do.

The 1985 revision added user-defined functions and multiple input streams, the POSIX standard formalized the language, and it became a mandatory Unix utility — which is why it is already on your laptop. Paul Rubin wrote GNU Awk (gawk) in 1986; it is probably the most widely deployed implementation today.

The family tree is worth a glance. It inherited its line-oriented pattern style from sed (1974), its slash-delimited regular expressions were carried on by Perl and later JavaScript, and the language influenced Tcl, Lua, and AMPL. The GNU manual even prints its recipe in the preface: 1 part egrep, 1 part SNOBOL, 2 parts ed, 3 parts C.

So when a one-liner looks like magic, it isn't. It is just a small program whose loop is implicit. Nearly fifty years old, and it still ships with every machine.

Full history: https://www.gnu.org/software/gawk/manual/
Background: https://en.wikipedia.org/wiki/AWK