Multi-condition filter awk
Print lines where field 2 > 500 AND field 5 is POST
awk '$2 > 500 && $5 == "POST"' access.log
more awk
all 15 commands →
Reformat output
awk '{printf "%-20s %5d\n", $1, $2}' data.txt
Run awk script from file
awk -f transform.awk input.txt
In-place-style transform with awk
awk '{gsub(/foo/, "bar"); print}' input.txt > tmp && mv tmp input.txt
Process CSV with quotes (gawk)
gawk -v FPAT='([^,]+)|("[^"]+")' '{print $2}' data.csv
BEGIN/END blocks
awk 'BEGIN{print "Start"} {lines++} END{print lines" lines processed"}' file.txt