how to get PID only

The below command returns full line.How can i get only PID from this line ie 15794 from the below example

(FI NY) nbswpsa52.ny.ficc.gs.com~ ->ps -ef | grep keepalive | grep -v keepaliveStub | grep -v swapback | grep -v grep
ficctprd 15794 1 0 13:12:58 ? 0:01 keepalive

Continuing on your solution, try this.

ps -ef | grep keepalive | grep -v keepaliveStub | grep -v swapback | grep -v grep | awk '{ print $2 }'

Vino

Thanks It worked

try this. much simpler and to the point:

ps -eo comm,pid | awk '$1 == "keepalive" { print $2 }'