The UNIX and Linux Forums  

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 here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Need Help with awk and arrays fusionX Shell Programming and Scripting 7 02-11-2008 03:41 PM
Simple Event Processing != Complex Event Processing iBot Complex Event Processing RSS News 0 12-16-2007 09:10 AM
awk arrays imonthejazz Shell Programming and Scripting 1 09-21-2007 06:29 AM
KSH and arrays whited05 Shell Programming and Scripting 1 06-24-2005 09:07 AM
Two or more arrays in Awk nitin UNIX for Advanced & Expert Users 1 12-10-2001 06:37 PM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 02-11-2008
Registered User
 

Join Date: Jan 2008
Posts: 9
Exclamation Processing with AWK and Arrays

Done, thanks for the help - worked.

Last edited by fusionX; 02-19-2008 at 10:01 PM. Reason: Job Done. now its owkring.
Reply With Quote
Forum Sponsor
  #2  
Old 02-11-2008
Klashxx's Avatar
HP-UX/Linux/Oracle
 

Join Date: Feb 2006
Location: Almerķa, Spain
Posts: 383
Pretty rustic, but:
Code:
awk '{
     ipArray[$1]++
     dateM[$5$6$7]++
     if ( dateM[$5$6$7] >= maxD )
           if ( dateM[$5$6$7] > maxD )
           {
           maxD=dateM[$5$6$7]
           MaxDate=$5"/"$6"/"$7
           }
        else if ( dateM[$5$6$7] == maxD  &&   ! f[$5$6$7] )
           {
           MaxDate=MaxDate" "$5"/"$6"/"$7
           f[$5$6$7]=1
           }
     if ( ipArray[$1] >= max )
         max=ipArray[$1]
     }
END{
   print "MaxDate: "MaxDate
   for (j=max;j>=1;--j)
       {
       for (y in ipArray)
            {
            if ( ipArray[y] == j )
               {
               print y, ipArray[y] 
               o++
               if ( o == 3 )
                  exit
               }
             }
       }
} ' FS="( )|(\\\[)|(\/)|(:)" file

Last edited by Klashxx; 02-11-2008 at 04:38 AM. Reason: Bug solved
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 06:43 AM.


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

Content Relevant URLs by vBSEO 3.2.0