LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 07-21-2010, 12:58 PM   #1
raggmopp1961
LQ Newbie
 
Registered: Sep 2006
Distribution: RehHat, Fedora Core
Posts: 14

Rep: Reputation: 0
count multiple objects in shell script


Hi all:

Trying to count the number of oracle instances on HPUX 11.23 - using ksh. I have multiple instances running and I would like to have a count for how many processes for each instance. Example, run the 'ps -efu oracle' command and for each instance increment a counter. So I am looking for
INT1=# INT2=# INT3=# ... INTn=#

I keep thinking a 'do-while' or some type of 'while' loop but I am missing something, somewhere...

Many thanks!
 
Old 07-22-2010, 08:56 AM   #2
bbeers
Member
 
Registered: Jul 2002
Location: Florida
Distribution: Centos, Slackware
Posts: 260

Rep: Reputation: 30
Do you have pstree?

Here's an example:

$ pstree | grep mingetty
|-6*[mingetty]

This shows that there are 6 instances of mingetty running on my system.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] count number of CD-ROMs on a system using shell script kushalkoolwal Programming 2 04-07-2010 08:48 PM
SHELL SCRIPT for multiple SCRIPTS rahulruns Programming 5 11-25-2009 11:13 AM
Runs Multiple shell script inside a main script using crontab srimal Linux - Newbie 4 10-22-2009 06:19 PM
Shell script for multiple OS investmentbnker75 Programming 2 06-28-2009 04:37 PM
shell script - while loop with multiple conditions ronsha Programming 13 12-10-2005 04:08 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 06:43 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration