[CentOS] Awk help

Joseph L. Casale JCasale at activenetwerx.com
Mon Jun 23 17:25:45 UTC 2008

I have csvde dump from active directory I process on my postfix mta.
It takes output like this:

"CN=Curtis xxx,OU=Domain Users,OU=xxx xxx,DC=xxx-xxx,DC=local",X400:c=US\;a= \;p=xxx xxx xxx\;o=Exchange\;s=xxx\;g=xxx\;;SMTP:Cxxx at xxx-xxx.com

and should return a relay_recipient map in the form of:
Cxxx at xxx-xxx.com     OK

The command I am using is:
cat $1 | tr -d \" | tr , \\n| tr \; \\n | awk -F\: '/(SMTP|smtp):/ {printf("%s\tOK\n",$2)}'

Everything up to the awk is working, it drops the smtp: but its putting OK's all over the darn place.
Anyone familiar enough with awk and printf that can suggest why this happens?


More information about the CentOS mailing list