What does awk do?
awk processes text column by column. awk '{print $1}' prints the first column; $NF is the last column.
awk [-F delim] 'program' [file]
Most useful options
| Option | What it does |
|---|---|
| -F | field separator |
| $1 … $NF | first … last column |
| NR | line number |
| /regex/ {print} | only lines matching |
awk examples
In security work
awk turns messy logs into clean columns you can sort and count.
Questions about awk
How do I print a column in Linux?
awk '{print $2}' file prints the second column.