The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Advanced & Expert Users
Google UNIX.COM


UNIX for Advanced & Expert Users Advanced UNIX and Linux questions go here. Expert-to-Expert.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
shell script doubt ravi raj kumar Shell Programming and Scripting 5 12-05-2007 01:16 AM
colors in BASH, doubt with script jaduks Shell Programming and Scripting 4 11-19-2007 01:21 AM
Doubt on Executing unix commands in script Naresh Kumar Shell Programming and Scripting 2 06-05-2006 04:49 PM
doubt in /etc/inittab script esham Shell Programming and Scripting 2 11-11-2005 09:03 PM
Unix + oracle doubt....involving shell script mexx_freedom UNIX for Dummies Questions & Answers 2 08-02-2001 06:48 AM

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 07-01-2008
Registered User
 

Join Date: Jul 2008
Posts: 12
Unhappy i have a doubt with the awk script??

Hi Guys,

I am new to this forum, i have doubt with a awk script. I want to generate a list where i can busiest hour from a list of a data.

05/19/2008 14:27:19 - avg: 0 max: 0 min: 0 samples: 0 total: 0
05/19/2008 14:28:19 - avg: 0 max: 0 min: 0 samples: 0 total: 0
05/19/2008 14:29:19 - avg: 0 max: 0 min: 0 samples: 0 total: 0
05/19/2008 14:30:19 - avg: 0 max: 0 min: 0 samples: 0 total: 0
05/19/2008 14:31:19 - avg: 0 max: 0 min: 0 samples: 0 total: 0
05/19/2008 14:32:19 - avg: 0 max: 0 min: 0 samples: 0 total: 0
06/16/2008 17:10:17 - avg: 1 max: 1 min: 0 samples: 1 total: 1
06/16/2008 17:11:17 - avg: 1 max: 1 min: 0 samples: 1 total: 1
06/16/2008 17:12:17 - avg: 1 max: 1 min: 0 samples: 1 total: 1
06/16/2008 17:13:17 - avg: 1 max: 1 min: 0 samples: 1 total: 1
06/16/2008 17:14:17 - avg: 1 max: 1 min: 0 samples: 1 total: 1
06/16/2008 17:15:17 - avg: 1 max: 1 min: 0 samples: 1 total: 1
06/16/2008 17:16:17 - avg: 1 max: 1 min: 0 samples: 1 total: 1
06/16/2008 17:17:17 - avg: 1 max: 1 min: 0 samples: 1 total: 1
06/16/2008 17:18:17 - avg: 1 max: 1 min: 0 samples: 1 total: 1
06/17/2008 14:18:29 - avg: 1 max: 1 min: 0 samples: 1 total: 1
06/17/2008 14:19:29 - avg: 1 max: 1 min: 0 samples: 1 total: 1
06/17/2008 14:20:29 - avg: 1 max: 1 min: 0 samples: 1 total: 1
06/17/2008 14:21:29 - avg: 1 max: 1 min: 0 samples: 1 total: 1
06/17/2008 14:22:29 - avg: 1 max: 1 min: 0 samples: 1 total: 1
06/17/2008 14:23:29 - avg: 1 max: 1 min: 0 samples: 1 total: 1
06/17/2008 14:24:30 - avg: 1 max: 1 min: 0 samples: 1 total: 1
06/17/2008 14:25:30 - avg: 1 max: 1 min: 0 samples: 1 total: 1
06/17/2008 15:46:30 - avg: 1 max: 1 min: 0 samples: 1 total: 1
06/17/2008 15:47:30 - avg: 1 max: 1 min: 0 samples: 1 total: 1
06/17/2008 15:48:30 - avg: 1 max: 1 min: 0 samples: 1 total: 1
06/17/2008 15:49:30 - avg: 1 max: 1 min: 0 samples: 1 total: 1
06/17/2008 15:50:30 - avg: 1 max: 1 min: 0 samples: 1 total: 1
06/17/2008 15:51:30 - avg: 1 max: 1 min: 0 samples: 1 total: 1
06/17/2008 15:52:30 - avg: 1 max: 1 min: 0 samples: 1 total: 1
06/17/2008 15:53:30 - avg: 1 max: 1 min: 0 samples: 1 total: 1
06/17/2008 15:54:30 - avg: 1 max: 1 min: 0 samples: 1 total: 1
06/17/2008 15:55:30 - avg: 1 max: 1 min: 0 samples: 1 total: 1
06/17/2008 15:56:30 - avg: 1 max: 1 min: 0 samples: 1 total: 1
06/17/2008 15:57:30 - avg: 1 max: 1 min: 0 samples: 1 total: 1
06/17/2008 15:58:30 - avg: 1 max: 1 min: 0 samples: 1 total: 1
06/17/2008 15:59:30 - avg: 1 max: 1 min: 1 samples: 3 total: 3

Here in this the second column is the time stamp. I want to find the busiest hour for a particular day.
can u help me guys with this, i tried this but i am not able to get it perfect. i am able to get the result but no perfect.

awk -F':' '{var = $1; if (var ~ /14/) print NR , $0 }' trap.stats | more

the output i get is

1 05/19/2008 14:27:19 - avg: 0 max: 0 min: 0 samples: 0 total: 0
2 05/19/2008 14:28:19 - avg: 0 max: 0 min: 0 samples: 0 total: 0
3 05/19/2008 14:29:19 - avg: 0 max: 0 min: 0 samples: 0 total: 0
4 05/19/2008 14:30:19 - avg: 0 max: 0 min: 0 samples: 0 total: 0
5 05/19/2008 14:31:19 - avg: 0 max: 0 min: 0 samples: 0 total: 0
6 05/19/2008 14:32:19 - avg: 0 max: 0 min: 0 samples: 0 total: 0
7 05/19/2008 14:33:19 - avg: 0 max: 0 min: 0 samples: 0 total: 0
8 05/19/2008 14:35:23 - avg: 0 max: 0 min: 0 samples: 0 total: 0
9 05/19/2008 14:36:23 - avg: 0 max: 0 min: 0 samples: 0 total: 0
10 05/19/2008 14:37:23 - avg: 0 max: 0 min: 0 samples: 0 total: 0
11 05/19/2008 14:38:23 - avg: 0 max: 0 min: 0 samples: 0 total: 0
12 05/19/2008 14:39:23 - avg: 0 max: 0 min: 0 samples: 0 total: 0
13 05/19/2008 14:40:23 - avg: 0 max: 0 min: 0 samples: 0 total: 0
14 05/19/2008 14:41:23 - avg: 0 max: 0 min: 0 samples: 0 total: 0
15 05/19/2008 14:42:23 - avg: 0 max: 0 min: 0 samples: 0 total: 0
16 05/19/2008 14:43:23 - avg: 0 max: 0 min: 0 samples: 0 total: 0
17 05/19/2008 14:44:23 - avg: 0 max: 0 min: 0 samples: 0 total: 0
18 05/19/2008 14:45:23 - avg: 0 max: 0 min: 0 samples: 0 total: 0
19 05/19/2008 14:46:23 - avg: 0 max: 0 min: 0 samples: 0 total: 0
20 05/19/2008 14:47:23 - avg: 0 max: 0 min: 0 samples: 0 total: 0


so i know that on 05/19/2008, during 1400 hrs there were 20 errors.
but i want a more customized trap where i get these errors according to the date.


can u help me guys
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 07-01-2008
awk awk is offline
Registered User
 

Join Date: Feb 2007
Posts: 113
Would something like this help?

Code:
cut -c -13 filename | sort | uniq -c
If you are sure the data is sorted - ignore the sort.
Reply With Quote
  #3 (permalink)  
Old 07-01-2008
Registered User
 

Join Date: Oct 2007
Location: USA
Posts: 482
Quote:
Originally Posted by asirohi View Post
but i want a more customized trap where i get these errors according to the date.
Show how the customized trap output should look like.
Reply With Quote
Google UNIX.COM
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 07:47 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0