![]() |
Hello and Welcome from to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | 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 and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| column extract help | cvm | Shell Programming and Scripting | 1 | 04-24-2008 05:19 PM |
| extract using sed/awk - need help? Please!! | gzs553 | Shell Programming and Scripting | 5 | 10-08-2007 05:54 PM |
| Please help! Sed extract a pattern | zhen | Shell Programming and Scripting | 11 | 09-18-2006 01:36 PM |
| tar. I can't extract | volleyboy | UNIX for Dummies Questions & Answers | 1 | 02-17-2006 11:54 AM |
| extract from TAR | big123456 | UNIX for Advanced & Expert Users | 8 | 07-28-2005 04:00 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
How to extract the PID from 'ps -ef'
Hi
I am writing a shell script in ksh where I have to grep for a process name , say XYZ from "ps -ef" and then extract it's PID. ps -ef | grep XYZ gives - " int 7738 25734 1 02:00:49 pts/tc 0:00 grep XYZ" I am thinking of replacing one or more occurrences of the space with pipe "|", so the output will be - |int|7738|25734|1|02:00:49|pts/tc|0:00|grep|XYZ Then I want to use the "cut -d"|" -f3 which will give 7738, the PID. But I am not able to replace one or more occurrences of the space with a single pipe. I have tried in many many different ways, but I am in vain. Can you please show me the way how it can be done ? Thanking you in advance ... Nirmalya |
|
||||
|
Quote:
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|