awk 'pattern {action}'
awk '$0 ~ /500/ { print $0 }' access.log
# This is equivalent to
awk '$0 ~ /500/' access.log
- example taken from Intro to awk – passionplay
$0
– search each line and find if there’s a 500 in it- print the line (this is the default behaviour)
Links
Awk - A Tutorial and Introduction by Bruce Barnett | The Grymoire – home for UNIX wizards
An Awk Primer – Wikibooks
POSIX-2017 Shell & Utilities | Wikimedia
sed & awk, 2nd Edition | O’Reilly