Print a column
Print the 3rd field, split by whitespace
awk '{print $3}' file.txt
- tool
- awk15 commands
More awk commands
-
awk -F: '{print $1, $3}' /etc/passwdUse a colon as the separator and print the user name and UID
-
awk '/ERROR/ {print NR": "$0}' app.logPrint the line number and text of lines with ERROR
-
awk '{sum += $4} END {print sum}' access.logAdd up a numeric column (here the 4th) and print the total
-
awk '/START/,/END/' file.txtPrint lines from START to END, both included
-
awk 'NR>1 {print $1, $2}' data.csvProcess all lines except the first one (header)