De manual :
Initially, because old programs may use ‘{’ and ‘}’ in regexp constants, gawk did not match interval expressions in regexps.
However, beginning with version 4.0, gawk does match interval expressions by default. This is because compatibility with POSIX has become more important to most gawk users than compatibility with old programs.
Como o Ubuntu 12.04 tem o GNU awk 3.1.8 e o 14.04 tem 4.0.1 , você deve estar no 12.04 (ou outro lançamento antigo).
Defina POSIXLY_CORRECT
para o comportamento POSIX:
$ echo "a{2,3}" | POSIXLY_CORRECT=1 gawk '/a{2,3}/ {print}'
$ echo "aa" | POSIXLY_CORRECT=1 gawk '/a{2,3}/ {print}'
aa
Ou use a opção -r
se quiser manter as extensões GNU e usar expressões de intervalo:
-r
--re-interval
Allow interval expressions (see Regexp Operators) in regexps. This is now gawk’s default behavior. Nevertheless, this option remains (both for backward compatibility and for use in combination with
--traditional
).