[SunHELP] repost: egrep w/multiple criteria

Will Mc Donald wmcdonald at ntlworld.com
Fri Jul 12 08:57:51 CDT 2002


If you want to find a line with both "this" and "test" in it then...

http://www.csci.csusb.edu/dick/samples/egrep.html

ps -aef | grep '[/]this.*test'

would do, no? Or do you need to find "test" followed by "this" as well as
"this" followed by "test"?

Those square brackets are only in there to prevent grep finding itself. Saves
you spawning another grep -v.

Will.


----- Original Message -----
From: "Markham, Richard" <RMarkham at hafeleamericas.com>
To: "Sunhelp (E-mail)" <sunhelp at sunhelp.org>
Sent: Friday, July 12, 2002 2:49 PM
Subject: [SunHELP] repost: egrep w/multiple criteria


> How can I egrep for a process that contains both EXPR1 and
> EXPR2.  Where EXPR1 "could" be /this and EXPR2 could be
> test.
>
> For example:
>
> > ps -aef | grep -v grep | egrep '/this&test'
> luser  1640  1628  0   Jul 09 ?        1:18 /this/is/a/test
>
> *the above syntax doesn't return anything.



More information about the SunHELP mailing list