Print only lines that match a regex.
Section: awk Scripting Patterns
Match with regex in awk
bash
bash
awk '/ERROR|WARN/' app.logExplanation
A pattern-only awk program prints matching lines by default.
Learn the surrounding workflow
Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.
Related commands
Same sheet · prioritizing awk Scripting Patterns
Use BEGIN and END blocks
Print headers and footers around processed output.
Print rows matching a condition
Show lines where column 3 is greater than 100.
Print selected columns
Show the first and third whitespace-delimited fields.