what should egrep '|root' /etc/passwd print?

Andrew Hume andrew at alice.UUCP
Sat Sep 17 07:51:14 AEST 1988



it sounds appealing to allow a missing RE to mean the empty string
but i am unconvinced as to its utility. the examples show this; there
is little to choose between
	grep -c '' and grep -c '^'
for counting lines. the latter is one char longer but needs no new concepts.
if the example you realy want to work is
	ls | egrep '\.c(|\.BAK)$'	- find *.c and *.c.BAK files
then you can do that with the current egrep by
	ls | egrep '\.c(\.BAK)?$'
this time the patterns are the same length but no new concepts required.
can anyone think of other useful meanings for the null RE?



More information about the Comp.unix.wizards mailing list