Operating System - HP-UX
1838469 Members
2714 Online
110126 Solutions
New Discussion

Need help to make a little script

 
SOLVED
Go to solution
R.O.
Esteemed Contributor

Need help to make a little script

Hi all,

I need help to make an script to do this:
- Take the number of processes from top
- Append the date to the right of that number of processes.

The output will be, in example:

125 081004-23:30
135 081004-23:35
166 081004-23:30
etc...

I know the way of get both number of processes and date, but i do not know how to put in pairs, every "number of processes" with the minute the measure was taken.
Could anybody help me?

Regards,

R.O.
"When you look into an abyss, the abyss also looks into you"
4 REPLIES 4
Slawomir Gora
Honored Contributor
Solution

Re: Need help to make a little script

Hi,


echo "`ps -ef | wc -l` `date`" >> /tmp/data.txt
Bharat Katkar
Honored Contributor

Re: Need help to make a little script

Hi,
Could explain your question again?

You r talking about the processes that r displayed in the TOP.
Is it that you want to capture the no. of processes shown by top and then show the date/time of that particular instance.
Regards,
You need to know a lot to actually know how little you know
R.O.
Esteemed Contributor

Re: Need help to make a little script

What Slawomir Gora posted was exactly what I needed.

Thank You and regards,

R.O.
"When you look into an abyss, the abyss also looks into you"
Franky_1
Respected Contributor

Re: Need help to make a little script

Hi,

you can use the following

echo "`ps -ef|wc -l` `date +%d%m%y`-`date +%H:%M`" >> /tmp/

This creates your desired output and is better to use here than top

Regards

Franky
Don't worry be happy