Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

nawk syntax

Status
Not open for further replies.

ac325ci

MIS
Jan 16, 2004
128
US
in nawk can u do
a

if pattern1 and pattern2 found and not pattern4 and pattern5 are present;
print something..

so far i have

if ( /pattern1/ || /pattern2/ ) && ( ! /pattern3/ ) ...

this doesnt seem to work..

basically im trying to find pattern1 and 2.. but if pattern3 and 4 are also present then ignore it.. kinda like grepping for pattern1 and pattern2 but grep -v pattern3 and 4 out of it.. thanks in advance..
 
Hi

First of all your code has a syntax problem :
Code:
if [red]([/red]( /pattern1/ || /pattern2/ ) && ( ! /pattern3/ )[red])[/red] [gray]...[/gray]
But I think this is what you want :
Code:
if ( /pattern1/ && /pattern2/ && !/pattern3/ && !/pattern4/ ) [gray]...[/gray]

Feherke.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top