execution problem

HI

I am trying to check the status of port using command

/code:
netstat -an | grep port

/Output:

.2009 *. 0 0 65535 0 LISTEN

what i am trying to do is

i want to grep only status Wether the port is established/listen if so show ok else show error
and for same i am using below code:

/code:
netstat -an | grep *.2009 |awk '{ if ($7!="LISTEN" || $7!="ESTABLISHED")print "OK" ; else print $7;}'

/output:
OK

In this code i am trying to print ok if port is in "LISTEN and ESTABLISHED" mode else print $7(port status)

but when i run this code it always show OK either port is established or not.

Kindly correct it or suggest me the right code.

netstat -an | grep -q '\*\.2009' 
# if status is ok, we found the socket, other not ok
[ $? -eq ] && echo 'ok'  || echo 'not ok'

Also - you need to escape (put a backslash in front of) * and . characters in a grep pattern

And.
grep -q -- the q option may not be on your system use

 netstat -an | grep '\*\.2009' > /dev/null

instead