awk printing against the condition -



awk printing against the condition -

i have simple question not figure out.

i have file want print lines not match status specify in awk if condition. can print condition, how other work?

this code:

awk '{if ($18==0 && $19==0 && $20==0 && $21==0) print $0}' file

i tried this:

awk '{if !($18==0 && $19==0 && $20==0 && $21==0) print $0}' file

but sec 1 doesn't work, help appreciated. give thanks you.

the negation (!) needs within parentheses:

awk '{if (!($18==0 && $19==0 && $20==0 && $21==0)) print $0}' file

and add together set within wrap everything.

(fyi, if had given how "didn't work" (i.e., syntax error on !, have been more helpful. please remember include error messages or symptoms of not working future questions!)

awk

Comments