Pattern Action
Noun · Development
Definitions
A programming model in which a program is a list of rules, each a condition paired with a block of code, and every piece of input is tested against each rule in turn, running the action wherever the pattern matches. It is the heart of AWK, created in 1977 by Alfred Aho, Peter Weinberger, and Brian Kernighan, where a program such as $3 > 100 { print $1 } prints the first field of every line whose third field exceeds 100. AWK lets either half be omitted: a pattern with no action prints the matching line, and an action with no pattern runs on every line, while the special BEGIN and END patterns run before and after all input. The same shape appears in sed, lex, intrusion-detection rules such as Snort's, and firewall rule sets. Its appeal is that the looping, reading, and field splitting are implicit, leaving only the logic that matters.
In plain English: A style of programming where you say 'when you see THIS, do THAT' — the program scans through data and fires off actions whenever it spots a match.
Example: "In AWK, /error/ { count++ } is a pattern-action rule: match lines containing error, increment the counter."