🧀 Learn Linux

Master·Read and process text

awk: Extract structured text fields

Put in free practice

Syntax

awk [-F delimiter] '{print $n}' [file]

Options

-F
field separator

Examples

awk -F , '{print $2}' data/users.csv

Usage and sandbox support

The teaching subset only supports printing a field or an entire $0 line, and does not support the generic awk program.

Hands-on exercises

Full documentation ↗

Related commands