Scripts in awk may contain one or more rules.
Each rule within an awk script consists of a pattern and an associated action. The pattern describes a section within a line of text that needs to be matched in order for the associated action to take place. The action is enclosed in squiggly braces to separate it from the pattern:
The pattern or the action can be omitted from an awk rule, but it is not possible for both the pattern and the action to omitted.
If a rule does not include a pattern, then the action within the rule is performed for every input line.
If a rule does not include an action, then the [[default_action?]] is used. The [[default_action?]] is to output all [[line?]]s that matches the pattern: