awk
and, and
Syntax
awk [options] 'pattern {action}' fileParameters
| Parameters | Description | Examples | Level |
|---|---|---|---|
-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/passwdUID 1000
awk '$3 > 1000 {print $1, $3}' /etc/passwdand
awk '{sum += $1} END {print sum}' numbers.txt80%
df -h | awk 'NR>1 && $5+0 > 80 {print $6, $5}'CSV, and
awk -F, '{print NR": "$2}' data.csvTips
- $0, $1-$n
- BEGIN, END
- printf : awk '{printf "%-10s %d\n", $1, $2}'
- : ps aux | awk '$3 > 5 {print $11}' CPU