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)

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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