Track the highest number in a field.
Section: awk Filtering and Aggregation
Find the maximum value
bash
bash
awk 'NR==1 || $2 > max {max=$2} END {print max}' values.txtExplanation
Awk is often enough for lightweight numeric analysis without needing a spreadsheet.
Learn the surrounding workflow
Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.
Related commands
Same sheet · prioritizing awk Filtering and Aggregation
Print rows matching a condition
Show lines where column 3 is greater than 100.
Print selected columns
Show the first and third whitespace-delimited fields.
Use BEGIN and END blocks
Print headers and footers around processed output.