How does awk distinguish between use of BRE versus ERE ? For sed there is the -E option one can use.

  • Get the book Effective AWK Programming, 5th Edition, by Arnold Robbins to start learning about awk.
    – Ed Morton
    Feb 1 at 13:43

1 Answer 1


It does not need to distinguish between the two since regular expressions in awk are always POSIX extended regular expressions.

From the POSIX specification for awk:

The awk utility shall make use of the extended regular expression notation [...]

I'm not aware of any awk implementation that introduces a non-standard option for switching to POSIX basic regular expressions.

The sed utility always uses POSIX basic regular expressions unless you use it with its (so far) non-standard but fairly commonly available -E option. The grep utility also defaults to POSIX basic regular expressions, but the -E option that enables it to use POSIX extended regular expressions is actually standard (while -P for Perl-compatible regular expressions, PCRE, is non-standard and not commonly implemented on non-GNU systems). The grep utility can additionally interpret the given expressions as plain strings with its standard -F option.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.