gawk vs mawk: case‑insensitive matching compatibility
0 reputation · 06 Jan 2022, 07:14 UTC
Goal
To create a repeatable development environment for awk scripts that rely on case‑insensitive pattern matching, developers must understand how the IGNORECASE variable and inline (?i) flags behave across implementations.
Constraints & Uncertainty
GNU awk (gawk) supports the global variable IGNORECASE and the inline (?i) flag, but neither mawk nor nawk provide these features. The POSIX standard does not mandate a case‑insensitive matching mechanism, leading to inconsistent results when scripts are run on different awk flavors.
Questions
1. Should the awk standard introduce a portable case‑insensitive matching flag, and if so, what syntax would best balance compatibility and expressiveness?
2. What testing strategy can reliably detect non‑portable case‑insensitive behavior across gawk, mawk, and nawk in a continuous‑integration pipeline?
3. If a script must run on all major awk variants, what best‑practice pattern should be used to emulate case‑insensitive matching without relying on implementation‑specific features?