what should egrep '|root' /etc/passwd print? (Everything)

Ozan Yigit oz at yunexus.UUCP
Fri Sep 16 00:59:07 AEST 1988


In article <8492 at smoke.ARPA> Doug Gwyn  writes:
>In article <44414 at beno.seismo.CSS.GOV> Rick Adams writes:
>>What should 
>>	egrep '|root' /etc/passwd
>>print?
>
>The question of how to handle empty strings in regular expressions
>does not have a clear-cut answer.  

Oh ??? Just what does '(foo)?' match on your egrep ?? It just happens
to be the same thing as E|foo (E for Epsilon, or the null match),
or exactly what rick wants to match. It had a clear cut answer before,
but I am sure it is lost somewhere along the line. 

> .."sam", which has the most powerful
>regular expression mechanism of any of the editor-like programs I use,
>says the following:
>	?no operand for `|'

A parsing glitch no doubt. See, some expressions are more regular :-)
then others, so "sam" will no doubt accept the expression under a
disguise of "(foo)?". 

In any case, Rick should probably use jaw-improved-gnu-egrep for
correct results.

oz
-- 
Crud that is not paged	        | Usenet: ...!utzoo!yunexus!oz
is still crud. 			|   ...uunet!mnetor!yunexus!oz
	andrew at alice		| Bitnet: oz@[yulibra|yuyetti]
				| Phonet: +1 416 736-5257x3976



More information about the Comp.unix.wizards mailing list