awk

and, and

Syntax

awk [options] 'pattern {action}' file

Parameters

ParametersDescriptionExamplesLevel
-F Common
-v Common
-f awk Common
NR : Common
NF : Common

Examples

awk '{print $1}' file.txt

, and UID

awk -F: '{print $1, $3}' /etc/passwd

UID 1000

awk '$3 > 1000 {print $1, $3}' /etc/passwd

and

awk '{sum += $1} END {print sum}' numbers.txt

80%

df -h | awk 'NR>1 && $5+0 > 80 {print $6, $5}'

CSV, and

awk -F, '{print NR": "$2}' data.csv

Tips

Related Commands