AWK: old but still somewhat useful

As a programming language, AWK is no longer useful. No significant program has been written for AWK in many years. Indeed, it's become quite unusual to see any AWK script.

This hasn't always been true. Henry Spencer famously wrote an entire assembler in AWK: aaa — The Amazing AWK Assembler. But AWK has had its heyday, and is now in complete decline.

But for what is still useful?

AWK is still quite useful at the command line. It is still the most concise way to break apart lines; you still see many shell scripts that include lines like these:

% awk -F: '{print $5}' < /etc/passwd | sort -u

The most useful "awk-isms"

One nice thing about AWK is that doubles as a (slow) replacement for grep:

% awk '/root/' /etc/passwd
But even better than grep, it allows you to modify the stream very easily:

$ awk -F: '/gnats/ {print $5}' /etc/passwd
Gnats Bug-Reporting System (admin)

But otherwise, Perl or Python have much nicer tools than AWK, and I cannot encourage you to use AWK for anything than the most occasional appearance as a component of a complex pipe.