The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
How print number bisla.yogender Shell Programming and Scripting 4 04-28-2008 06:51 AM
checking the smallest and largest number subin_bala Shell Programming and Scripting 4 04-24-2008 07:32 AM
to print number one less than actual number cdfd123 Shell Programming and Scripting 4 09-06-2007 06:56 AM
search the largest number and duplicates string fongthai Shell Programming and Scripting 13 05-18-2007 10:40 AM
How to print number of lines with awk ? maheshsri Shell Programming and Scripting 1 11-18-2005 02:19 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 05-06-2008
amp10388 amp10388 is offline
Registered User
  
 

Join Date: May 2008
Posts: 2
How to print largest and smallest number.

Hey. This is pretty easy stuff but I'm learning the basics of Unix at the moment so keep that in mind. I have to:

1) Write a C-shell script to monitor user activity on the server for 13 minutes.
2) Then print the smallest and largest number of users during these 13 minutes.

I have this:
1)
set number = ` who | wc -l `
@ x = 1

while ( $x < 14 )
echo " Cycle $x : number of users = $number "
@ x++
sleep 60
end

2)
But I having a hard time figuring out how to do the second part where I have to print the largest and smallest numbers. Any help will be appreciated!
  #2 (permalink)  
Old 05-07-2008
Yogesh Sawant's Avatar
Yogesh Sawant Yogesh Sawant is offline Forum Staff  
Part Time Moderator and Full Time Dad
  
 

Join Date: Sep 2006
Location: Rossem, Tazenda
Posts: 1,086
Lightbulb

another idea:
capture the desired output in a file for as much duration as you want (13 minutes in your case) (append to the file, don't overwrite it)
finally, analyze the data in the file to determine min and max values

pros:
you retain the data so that you can analyse it later
capturing the data and analysis of data are separated

cons:
you may end up filling disk space with the data files
  #3 (permalink)  
Old 05-07-2008
amp10388 amp10388 is offline
Registered User
  
 

Join Date: May 2008
Posts: 2
Quote:
Originally Posted by Yogesh Sawant View Post
another idea:
capture the desired output in a file for as much duration as you want (13 minutes in your case) (append to the file, don't overwrite it)
finally, analyze the data in the file to determine min and max values

pros:
you retain the data so that you can analyse it later
capturing the data and analysis of data are separated

cons:
you may end up filling disk space with the data files
Actually, I want to do it all in one script so I can see the largest and smallest users simultaneously with the output. Thanks for the input, though. Any other ideas?
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 09:58 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0