Skip to content
cheatsheet
home
/
cv
/
weblog
/
cheatsheet
/
proxy
/
vpn
/
status
/
links
EN
RU
☾
New version available
reload
×
cheatsheet
/
awk
/
Print specific column
Print specific column
awk
Print the 3rd whitespace-delimited field
awk '{print $3}' file.txt
⎘ copy
#awk
#linux
more awk
all 15 commands →
Custom field separator
awk -F: '{print $1, $3}' /etc/passwd
Filter rows by pattern
awk '/ERROR/ {print NR": "$0}' app.log
Sum a column
awk '{sum += $4} END {print sum}' access.log
Print lines between two patterns
awk '/START/,/END/' file.txt
Skip header line
awk 'NR>1 {print $1, $2}' data.csv