what should egrep '|root' /etc/passwd print?
Andrew Hume
andrew at alice.UUCP
Thu Sep 15 15:47:28 AEST 1988
it is true that youhave to think carefully about null regular expressions.
i (and gre) believe as sam does, '|root' is a syntax error as | is dyadic.
the behaviour of matching every line is just wrong. egrep handles this
as a special case; recall that egrep takes \n as a synonym for |.
aho wanted to forgive the user for being sloppy with quotes and blank lines
as in egrep '
abc
def
' file
which ordinarily has superfluous \n at the beginning and end. i agree that this
is a flimsy aim but that is the current practice with egrep.
i think that it is clear that grep '' file is always a syntax error;
there is no useful interpretation of such a regular expression.
More information about the Comp.unix.wizards
mailing list