Print lines between two patterns awk
Range pattern: include lines from START to END inclusive
awk '/START/,/END/' file.txt
more awk
all 15 commands →
Skip header line
awk 'NR>1 {print $1, $2}' data.csv
Count occurrences per key
awk '{count[$1]++} END {for (k in count) print count[k], k}' access.log | sort -rn
Print last field
awk '{print $NF}' file.txt
Multi-condition filter
awk '$2 > 500 && $5 == "POST"' access.log
Reformat output
awk '{printf "%-20s %5d\n", $1, $2}' data.txt