awk + add rules to awk command

1

I have the following awk command

   awk  '{if ( $2 == "x.name" ) {print "OK"} else {print "NOT OK" } }'

but $2 could be x.name or x-name or x:name

how to change the following awk in order to Support all rules (x.name or x-name or x:name)

jennifer

Posted 2010-10-07T09:03:28.670

Reputation: 897

Answers

2

awk  '{if ( $2 ~ /x[-.:]name/ ) {print "OK"} else {print "NOT OK" } }'

Ignacio Vazquez-Abrams

Posted 2010-10-07T09:03:28.670

Reputation: 100 516