4 ms·
Aha! This is a POSIX-required behavior, not documented in the GNU "info grep" or man page. According to POSIX, the syntax is: grep [-E|-F] [-c|-l|-q] [-insv
by kazinator 9y ago
Aha! This is a POSIX-required behavior, not documented in the GNU "info grep" or man page.
According to POSIX, the syntax is:
grep [-E|-F] [-c|-l|-q] [-insvx] -e pattern_list
What is pattern_list? "The pattern_list's value shall consist of one or more patterns separated by <newline> characters"
In the GNU man page and info, the pattern argument is referred to as the PATTERN metavariable, a noun in singular form. The only hint I can find that it can contain a plurality is this, in the man page:
-F, --fixed-strings
Interpret PATTERN as a list of fixed strings (instead of regular
expressions), separated by newlines, any of which is to be
matched.
This drops the hint that there may be multiple regular expressions in PATTERN separated by newlines, which may instead be treated as fixed strings.
A similar description is in the Info manual.
Elsewhere in both documents, PATTERN is misleadingly referred to as "the pattern".
This may be worth a documentation patch.