[NTLUG:Discuss] keep grep command out of the results of a "ps | grep" *Solved but why?*

Richard ntlug at rain4us.net
Thu Dec 11 17:14:53 CST 2008


Wayne Walker wrote:
> I usually just do:
>
> ps -elf | grep foo | grep -v grep
>
> The reason that putting a backslash in the regex works is because what
> is passed to grep is     a\getty   then grp converts \g to just g so
> grep is looking for agetty which does not match the a\getty that is inn
> the ps output for grep itself.
>   
OOOOOHHHHHHHH!!!!!   I get it!!!   That is SO simple!  I get it now.  
Thank you SO much.   My head and the wall here thank you too.

I knew I could have daisy chained two greps together like you did, but I 
try to limit the number of processes that I make the system run.  My 
efforts to stop doing  'cat filename | grep search_criteria'   seem like 
the best way to keep the Dept. of Redundancy Department off my derierre.


Thanks, Wayne.   PHEW.

-- 
Richard



More information about the Discuss mailing list