(?!...)
is a perl
regular expression operator while awk
regexps are a variant of the POSIX extended regular expressions (ERE).
(?!...)
is not incompatible with EREs as (?
is unspecified in EREs, so awk
implementations could choose to implement that operator as it wouldn't affect portable applications which cannot use it.
But while there are some egrep
/grep -E
implementations like ast-open's that do support it, I don't know of any awk
implementations that does (based on the error message, yours seems to be based on Brian Kernighan's original implementation which may not even support the {x,y}
interval operators). awk cannot use PCRE (a portable perl-compatible regexp libraries) as perl regexps as a whole are incompatible with awk
REs (like for the alternation operator behaviour, or \b
which means something different in perl
and awk
).
Here, you could use perl
instead:
perl -lae 'print $F[0] if /vault-(?!etcd|operator)/'
Or you could use a grep
with -o
and PCRE support, like pcregrep
or GNU grep
with it's -P
option:
grep -Po '^\s*+\K(?=.*vault-(?!etcd|operator))\S+'