This awk expression prints inet 34.45
as expected on OpenBSD:
echo "inet 34.45" | awk '/inet [0-9]+\./ { print }'
However, when I replace the +
with a bound {1,3}
, I am not getting any match:
echo "inet 34.45" | awk '/inet [0-9]{1,3}\./ { print }'
Both expressions work as expected on Linux with gawk. The gawk man page mentions that what it calls interval expressions were not originally supported by awk but later added to POSIX for consistency with egrep. The awk man page on OpenBSD mentions no such thing and just refers to the man page of re_format, which specifies bounds as usual.
Is this a bug or some undocumented limitation of OpenBSD awk?
Best Answer
That restriction is precisely documented.
From: http://man.openbsd.org/awk.1#STANDARDS