Skip to content

AWK

Fields

echo hello world | awk '{print $1, $2}'

Matching Pattern

awk '/error/' file

With Regex as Field Separator

REGEX: [.\-/ ] (dot, dash, slash, space)

echo one.two-three four | awk -F '[.\\-/ ]' '{print $2, $3}'