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)

link|improve this question

79% accept rate
feedback

1 Answer

up vote 2 down vote accepted
awk  '{if ( $2 ~ /x[-.:]name/ ) {print "OK"} else {print "NOT OK" } }'
link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.