[awk] Filter rows by a numeric column

Created on November 30, 2026

Use a numeric comparison to select rows by a column's value. Start with this scores.txt file.

name score
Alice 85
Bob 72
Carol 91

NR > 1 skips the header. $2 >= 80 selects rows where the second column is at least 80.

awk 'NR > 1 && $2 >= 80 {print $1, $2}' scores.txt

Output

Alice 85
Carol 91
awk Shell command