Ravi Sir's Cards › AWS
awk fields
This revision card explains awk fields. It starts from the need that split lines into columns. It describes $1 first, $NF last, -F sets sep. The how-to section notes pattern {action} per line. An example on the card is users and shells.
Read card text
What this card says
Why do we need it?
Split lines into columns.
What is it?
$1 first, $NF last, -F sets sep.
How to do it
pattern {action} per line.
Example
Users and shells.
awk -F: '{print $1, $NF}' /etc/passwd