![]() |
|
|
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 |
| ps avg | grep ? filter the desired out put. | varungupta | UNIX for Advanced & Expert Users | 1 | 04-10-2009 05:30 PM |
| Grep script to filter | kevin9 | Shell Programming and Scripting | 2 | 02-21-2009 01:59 AM |
| how to filter `last` command for yesterday only | skully | Shell Programming and Scripting | 1 | 06-26-2008 05:30 AM |
| grep a log file to filter previous dates | pinpe | Shell Programming and Scripting | 5 | 08-03-2007 02:25 PM |
| Filter results through pipe with grep | ckandreou | UNIX for Dummies Questions & Answers | 1 | 07-10-2006 03:04 PM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
filter grep command
I have ran into a small issue and I am not sure how to fix it. In one of our current scripts we have this line which does a grep to get the pid of the process. Code:
ps -ef | grep nco_p_syslog | grep $x | awk '{print $2}'
However this is not returning anything due to the how long the value of $x is. Which a sample value is... Code:
ot1p_stdby However as you can see a simple grep cuts this off... Code:
tivoli 20343 1 0 10:16:09 pts/1 0:00 /lcl/apps/Tivoli/netcool/omnibus/probes/solaris2/nco_p_syslog -manager ot1p_std I need to find a way to do a grep command like below only have it know off the _stdby contained within $x. So that even though $x contains the value ot1p_stdby it should cutt off the _stdby and only by ot1p when it does the following command.,,, Code:
ps -ef | grep nco_p_syslog | grep $x | awk '{print $2}'
I was not sure if there is a way to do this right in the command above. Thanks |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|