LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   output result from grep. (https://www.linuxquestions.org/questions/linux-newbie-8/output-result-from-grep-4175426885/)

brian00 09-12-2012 09:29 AM

output result from grep.
 
when I run the below and write the result to a file:

ps -ef |grep smon_MYDB


I got the result:

oracle 12689 1 0 Sep05 ? 00:00:09 ora_pmon_MYDB
oracle 22785 22781 0 07:24 ? 00:00:00 grep ora_pmon_MYDB


what command can I use to delete grep ora_pmon_MYDB? Basically, I only want to check if the process is running, I don't want to see the grep command.

pan64 09-12-2012 09:39 AM

usually
ps -ef | grep <process> | grep -v grep
is the solution, but would be better to use:
pgrep <process>


All times are GMT -5. The time now is 11:01 AM.