awk Cheatsheet

Top patterns.

Overview

awk is the line-by-line text processor that has been part of Unix for fifty years. Five primitives carry most operational use: field-aware splitting, pattern-action pairs, BEGIN/END blocks, built-in variables, and a small library of math and string functions. Fluency turns ad-hoc log spelunking into compact one-liners that replace multi-tool pipelines.

The approach

One-liners first, scripts only when the logic stops fitting on one line. Five idioms cover most operational awk use; memorising them moves the team from copy-paste to fluent text manipulation.

Why this compounds

Each one-liner that lands in muscle memory shortens the next investigation. Over a year the team's log-triage speed compounds; over two years awk becomes the default for any column-shaped data and the patterns spread to teammates by osmosis.