|
Home > Archive > Unix Shell > April 2005 > Using grep -E to test for and condition
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Using grep -E to test for and condition
|
|
| glenns@chartermi.net 2005-04-18, 2:54 am |
| I use grep to check for this 'or' that
(grep -E 'Value1 | Value2' )
BUT how can I test for an the 'and' condition?
I tried grep -E 'Value1 & Value2', but nothing is returned
I'm using HP-UX 11
Thanks
| |
|
| Could you not use egrep?
egrep "Value1.*Value2|Value2.*Value1"
<glenns@chartermi.net> wrote in message
news:1113578519.114387.41870@l41g2000cwc.googlegroups.com...
> I use grep to check for this 'or' that
> (grep -E 'Value1 | Value2' )
>
> BUT how can I test for an the 'and' condition?
> I tried grep -E 'Value1 & Value2', but nothing is returned
>
> I'm using HP-UX 11
> Thanks
>
| |
| Kevin Collins 2005-04-25, 8:48 pm |
| In article <SbidnTIrX70movffRVn-sA@comcast.com>, <dphillip79@comcast.net> wrote:
> Could you not use egrep?
Same thing as 'grep -E'... According to HP-UX docs for many years 'egrep is
deprecated'.
[vbcol=seagreen]
> egrep "Value1.*Value2|Value2.*Value1"
>
><glenns@chartermi.net> wrote in message
> news:1113578519.114387.41870@l41g2000cwc.googlegroups.com...
Kevin
--
Unix Guy Consulting, LLC
Unix and Linux Automation, Shell, PERL and CGI scripting
http://www.unix-guy.com
|
|
|
|
|