How to run a unix command in VI


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to run a unix command in VI
# 1  
Old 08-29-2005
Question 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
# 2  
Old 08-29-2005
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 }')
# 3  
Old 04-29-2009
MySQL

Hi,

If your question is to execute command in vi editor

In vi editor use this (:!command)

Cheers
Rakesh Damera
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. AIX

How to use dsadm command to run command on multi lpars?

how to run a command, such as "ls -l core" from one lpar to check multi lpars if core file exist? or what way can do a command on all lpars from one lpar? Thanks (1 Reply)
Discussion started by: rainbow_bean
1 Replies

2. Shell Programming and Scripting

How can i run sql queries from UNIX shell script and retrieve data into text docs of UNIX?

Please share the doc asap as very urgently required. (1 Reply)
Discussion started by: 24ajay
1 Replies

3. Shell Programming and Scripting

Help me!how to run autosys command in UNIX shell script

Hi all, Here is my scenario.. i need to get dates from an existing autosys calendar and compare it with current date with in a unix shell script. Please help me out and give me an approach to handle this....... the general autosys calendar command used is autocal_asc ,but this is... (1 Reply)
Discussion started by: shrik12345
1 Replies

4. Shell Programming and Scripting

Script for telnet and run one command kill it and run another command using while loop

( sleep 3 echo ${LOGIN} sleep 2 echo ${PSWD} sleep 2 while read line do echo "$line" PID=$? sleep 2 kill -9 $PID done < temp sleep 5 echo "exit" ) | telnet ${HOST} while is executing only command and exits. (5 Replies)
Discussion started by: sooda
5 Replies

5. Shell Programming and Scripting

Need help! command working ok when executed in command line, but fails when run inside a script!

Hi everyone, when executing this command in unix: echo "WM7 Fatal Alerts:", $(cat query1.txt) > a.csvIt works fine, but running this command in a shell script gives an error saying that there's a syntax error. here is content of my script: tdbsrvr$ vi hc.sh "hc.sh" 22 lines, 509... (4 Replies)
Discussion started by: 4dirk1
4 Replies

6. Shell Programming and Scripting

Is command line invocation of gnome-terminal to run more than one command possible?

Hello, I am trying to learn how to pass something more than a one-command startup for gnome-terminal. I will give an example of what I'm trying to do here: #! /bin/bash # #TODO write this for gnome and xterm USAGE=" ______________________________________________ ${0##*/} run... (0 Replies)
Discussion started by: Narnie
0 Replies

7. UNIX for Dummies Questions & Answers

Help run ls command along with find command

Hi, I want to run ls -lrt command along with find command. I want to get the list of files with timestamp, owner, group and permissions for the files larger than 1024k. I tried the below command, but it displays only the file names. ls -lrt | find . -name "*.*" -size +1024k -print Any... (7 Replies)
Discussion started by: TonySolarisAdmi
7 Replies

8. UNIX for Dummies Questions & Answers

How to run multiple command in single command?

Dear Unix Guru, I have several directories as below /home/user/ dir1 dir2 dir3 Each directory has different size. I want to print each directory size (Solaris command du -hs .) Can you please guide me how to achieve this? Thanks Bala (2 Replies)
Discussion started by: baluchen
2 Replies

9. Shell Programming and Scripting

How To Run Mml Command From Unix Script

Dear All I want to run some MML command on my node from my unix server. I am able to get mml prompt but after that my script is stop at mml prompt. No commnad is executed on mml prompt. Kindly help me out. Regards Jaydeep (0 Replies)
Discussion started by: jaydeep_sadaria
0 Replies

10. UNIX for Dummies Questions & Answers

run command Unix on a single line

Hi everybody.. I need to enter in bash mode and then run a command and this just in a single command line. I tried : "bash ^M| somecommand" but nothing.. How do I do to simulate the return button just right after the bash command ? Thanks.. (8 Replies)
Discussion started by: Riddick61
8 Replies
Login or Register to Ask a Question