[lug] grep question

Jonathan Briggs zlynx at acm.org
Tue Jan 29 12:56:40 MST 2002


Scott A. Herod wrote:

>Hello,
>
>A quick grep question:  I've got a file named "spam" that may contain
>"hello", "goodbye", both or neither.
>
>I need a grep command that returns true if either or both is present.
>The grep man page suggests that you can use the infix operator |
>(the pipe symbol) but I can't figure out the syntax.  Does anyone
>know how?
>
>I basically want something like:
>
>grep 'hello!good' spam
>
>Thanks,
>
>Scott
>_______________________________________________
>Web Page:  http://lug.boulder.co.us
>Mailing List: http://lists.lug.boulder.co.us/mailman/listinfo/lug
>
I believe you need to use either egrep or grep -E (they're both the same 
thing).  Then, egrep 'hello|goodbye' will work.





More information about the LUG mailing list