awk Command Examples

A versatile programming language for working on files. More information: https://github.com/onetrueawk/awk.

awk '{print $5}' {{path/to/file}}

awk '/{{foo}}/ {print $2}' {{path/to/file}}

awk -F ',' '{print $NF}' {{path/to/file}}

awk '{s+=$1} END {print s}' {{path/to/file}}

awk 'NR%3==1' {{path/to/file}}

awk '{if ($1 == "foo") print "Exact match foo"; else if ($1 ~ "bar") print "Partial match bar"; else print "Baz"}' {{path/to/file}}

awk '($10 == {{value}})'

awk '($10 >= {{min_value}} && $10 <= {{max_value}})'