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 > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
an hour less in 24 hour system bobo UNIX for Dummies Questions & Answers 3 10-23-2006 11:55 AM
how can i check if port is busy or if someone is using it ? umen IP Networking 1 01-28-2006 03:37 AM
CD Drive is busy nikk UNIX for Advanced & Expert Users 6 08-29-2004 01:59 PM
umount, device busy, but.. sTorm UNIX for Dummies Questions & Answers 10 08-20-2002 06:49 AM

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

Join Date: Jan 2007
Posts: 61
how to calculate busy hour

Dear All,
please tell me any script which can able to calculate the bus hours by claculating the volume for example
hour volume
1 100
2 200
3 300
4 7000
5 50
6 80
7 77
8 77
9 165
10 888
11 99
12 89
13 33
14 676
15 878
16 90
17 56
18 11
19 123
20 144
21 155
22 177
23 190
24 19

BUSY HOUR= 4
busy hour is 4 because the maximum volume is 7000 at 4.

kinldy any body can give me the scirpt which can do this .
  #2 (permalink)  
Old 01-28-2008
dennis.jacob dennis.jacob is offline Forum Advisor  
dj -------
  
 

Join Date: Feb 2007
Location: Singapore/Bangalore/Cochin
Posts: 579
Try this:

Code:
sort -n -k2 filename |  awk 'END{NF=$RS; print "BUSY HOUR="$1}'
  #3 (permalink)  
Old 01-28-2008
shary shary is offline
Registered User
  
 

Join Date: Jan 2007
Posts: 61
Dear All,

I am giving u the actual file but its seperated by "," comma.
all field actually separted by comma can u do this for this file

HOURS AccRq SucAcc FailAcc SucAccStart
0 18301 18301 0 18368
1 9412 9412 0 9452
2 7697 7697 0 7730
3 5060 5060 0 5068
4 3960 3960 0 3972
5 3837 3837 0 3851
6 5047 5047 0 5069
7 6102 6102 0 6124
8 8361 8361 0 8377
9 10183 10183 0 10206
10 14669 14669 0 14706
11 16577 16577 0 16622
12 12347 12347 0 12383
13 9040 9040 0 9067
14 8051 8051 0 8074
15 10818 10818 0 10792
16 20399 20399 0 20453
17 41259 41259 0 41514
18 36523 36523 0 36825
19 13581 13581 0 13734
20 12576 12576 0 12685
21 11332 11332 0 11432
22 13457 13457 0 13583
23 10898 10898 0 10996

output should be

BUSY HOUR =17
i am calculating on the basis of second field which is accrq and the highest value is 41259 against that walue the hour is 17.
so kindly tell me the script which can give me the output

BUSY HOUR =17
  #4 (permalink)  
Old 01-28-2008
dennis.jacob dennis.jacob is offline Forum Advisor  
dj -------
  
 

Join Date: Feb 2007
Location: Singapore/Bangalore/Cochin
Posts: 579
Try this:

Code:
sed -n '2,$p' filename | sed 's/,/ /g' |sort -n -k2 |  awk 'END{NF=$RS; print "BUSY HOUR="$1}'
  #5 (permalink)  
Old 01-28-2008
shary shary is offline
Registered User
  
 

Join Date: Jan 2007
Posts: 61
hi
thanx for ur support but when i am excuting ur statement it is not giving me any value.
the output will come like
BUSY HOUR=
so please kindly help me in this regard
  #6 (permalink)  
Old 01-28-2008
manas_ranjan's Avatar
manas_ranjan manas_ranjan is offline
Registered User
  
 

Join Date: Jul 2007
Location: Amsterdam
Posts: 177
Please try this out..........

cat <<filename>> | sort -nr -t',' -k2 | head -1 | awk 'END{ print $1" :- is BUSY Hour"}'

Last edited by manas_ranjan; 01-28-2008 at 05:53 AM.. Reason: replace field separator from : to ,
  #7 (permalink)  
Old 01-28-2008
shary shary is offline
Registered User
  
 

Join Date: Jan 2007
Posts: 61
Dear
still its giving no value the output is some what like
:- is BUSY Hour
there is no value
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 06:27 AM.


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