![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
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 |
| Forum Sponsor | ||
|
|
|
#2
|
||||
|
||||
|
Continuing on your solution, try this.
Code:
ps -ef | grep keepalive | grep -v keepaliveStub | grep -v swapback | grep -v grep | awk '{ print $2 }'
|
|
#3
|
|||
|
|||
|
Thanks It worked
|
|
#4
|
|||
|
|||
|
try this. much simpler and to the point:
Code:
ps -eo comm,pid | awk '$1 == "keepalive" { print $2 }'
Last edited by hadarot; 08-31-2005 at 01:01 AM. |
|||
| Google The UNIX and Linux Forums |