Simple Pattern Match

Hello !

Experts, I saw a ton of postings here about Awk pattern matching and even after going through all of it, what I have concocted isnt working for me.

Here is what I am after.

I have a huge set of csv files and in the fifth column, I have text like this ---

ANFD10239CS9
BCDD93948CS9
UUFS994937CS7
FJKDS93949CS9
....

Now, if I want to find any record that DOES NOT have NFD or CDD or UFS or PDC then display the record.

Here is what I have... & this isnt working.

awk '$5 !~ /NFD/ && /CDD/ && /UFS/ && /PDC/ {print $0}'

Im not sure as to what am I doing wrong here ?

Please help !

Thanks,
PGonzalez.

try this

# awk '$5 !~ /NFD|CDD|UFS|PDC/ {print $0}  ' file

Hi, the use of print is not needed , try:

awk '$5 !~ /NFD|CDD|UFS|PDC/ ' file

hi,yes not needed (default action) but needed when print only specific field and using print is not problem

awk '$5 !~ /NFD|CDD|UFS|PDC/ {print $0} ' file
awk '$5 !~ /NFD|CDD|UFS|PDC/ {print ; } ' file
awk '$5 !~ /NFD|CDD|UFS|PDC/ {print } ' file
awk '$5 !~ /NFD|CDD|UFS|PDC/ ' file

Of course, i'm talking about PG3 specific case.

Klashxx & ygemici,

Both your answers worked perfectly for me.

Greatly thank your contribution and as always your contribution to many a minion like me is truely cherished.

Pgonzalez.