How to run a unix command in VI

Hi,

I have below command to run in from a file.
Aim to run this command and assign that to a variable.

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

How can i do that?

Thanks,
Sateesh

use
var1=`ps -ef | grep keepalive | grep -v keepaliveStub | grep -i ficctprd | grep -v grep | awk '{ print $2 }'`

or
var1=$(ps -ef | grep keepalive | grep -v keepaliveStub | grep -i ficctprd | grep -v grep | awk '{ print $2 }')

Hi,

If your question is to execute command in vi editor

In vi editor use this (:!command)

Cheers
Rakesh Damera