Operating System - HP-UX
1834533 Members
2874 Online
110069 Solutions
New Discussion

Re: ps -ef | grep oracle...

 
SOLVED
Go to solution
Carlo Henrico_1
Regular Advisor

ps -ef | grep oracle...

Is there any way of adding some kind of counter to know how many of these entries there would be?

ps -ef | grep oracle

returns 80 - 150 of these each time and a bit of a schlep to count them...
Live fast, die young - enjoy a good looking corpse!
6 REPLIES 6
Andreas Voss
Honored Contributor
Solution

Re: ps -ef | grep oracle...

Hi,

use the wc command:

ps -ef | grep oracle | wc -l

This will count the lines.

Regards


federico_3
Honored Contributor

Re: ps -ef | grep oracle...

Try :

ps -ef | grep oracle | wc -l

or:
ps -ef| grep oracle | awk 'END {print NR}'

These will count the lines.

federico

Fedon Kadifeli
Super Advisor

Re: ps -ef | grep oracle...

It is better to use:

ps -fu oracle | ...
Daniel Correa
Advisor

Re: ps -ef | grep oracle...

Hi,

You can also do;

ps -ef | grep -c oracle
Alan Riggs
Honored Contributor

Re: ps -ef | grep oracle...

yeah Daniel!!!

Glad to see someone else actually remembers the -c flag to grep.

BTW, if the actual count is important please make sure to correct for the report of the grep statement itself.

ps -ef | grep oracle| grep -vc grep
Jim Welch
Respected Contributor

Re: ps -ef | grep oracle...

Just wondering what exactly you wanted to count...'ps -ef | grep oracle' would catch a lot of things...user name, process name, /.../oracle/... in the path to a file being executed, or even in a parmeter passed to a command...but then maybe that's what you intended.
Any sufficiently advanced technology is indistinguishable from Magic - Arthur C. Clarke