![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| 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 |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Done, thanks for the help - worked.
Last edited by fusionX; 02-19-2008 at 10:01 PM. Reason: Job Done. now its owkring. |
| Forum Sponsor | ||
|
|
|
#2
|
||||
|
||||
|
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 |
||||
| Google The UNIX and Linux Forums |