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 Advanced & Expert Users
.
google unix.com



UNIX for Advanced & Expert Users Expert-to-Expert. Learn advanced UNIX, UNIX commands, Linux, Operating Systems, System Administration, Programming, Shell, Shell Scripts, Solaris, Linux, HP-UX, AIX, OS X, BSD.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
doubt in /etc/inittab script esham Shell Programming and Scripting 3 04-17-2009 12:38 PM
shell script doubt ravi raj kumar Shell Programming and Scripting 5 12-05-2007 05:16 AM
colors in BASH, doubt with script jaduks Shell Programming and Scripting 4 11-19-2007 05:21 AM
Doubt on Executing unix commands in script Naresh Kumar Shell Programming and Scripting 2 06-05-2006 07:49 PM
Unix + oracle doubt....involving shell script mexx_freedom UNIX for Dummies Questions & Answers 2 08-02-2001 09:48 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 07-01-2008
asirohi asirohi is offline
Registered User
  
 

Join Date: Jul 2008
Posts: 56
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
  #2 (permalink)  
Old 07-01-2008
awk awk is offline
Registered User
  
 

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

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

Join Date: Oct 2007
Location: USA
Posts: 750
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.
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:10 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