Its purpose is to provide access to the various matchers implemented in GNU
grep in one form or another, in particular AWK matchers which aren’t available otherwise, probably for testing purposes (see bug 16481 which discusses adding the
However it is currently buggy, which is the reason why it’s documented as being undocumented:
On Thu, Jan 27, 2005 at 04:06:04PM -0500, Charles Levert wrote:
> The '-X' option, and in particular its use with the "awk" matcher
> ("-X awk") is undocumented.
please leave it undocumented.
It doesn't provide any new functionality besides -X awk.
And the implementation of awk regexps is not perfect, I think.
The new GNU regex conatins some means to set AWK style syntax, yes.
Yet gawk doesn't use it directly: it parses the regex first.
In particular, awk regexps allow escape sequences \NNN, where NNN is
an octal value. So /\040/ mathes space. grep -X awk doesn't seem to
I'm afraid that regex.c doesn't support these escape sequences.
We would have to make sure that the regexes are fully compatible with
awk regexes before we decided to document (and thus support) this
I think it's not worth the trouble.
A follow-up asked for the comment to be added, and provided a bit more background on the
My own inclination is to suggest just removing -X entirely. I suspect it was added by the original author mainly for testing purposes. If it's going to stay in, at least add a comment like this.
/* -X is undocumented on purpose. */
to avoid future discussion of a resolved issue.
which Stepan did shortly thereafter.