Hi All,
Perl newbie here. I have a conundrum that may be fairly simple to a veteran, but it is causing me grief.
What I have is four fields- Date, Time, Server Name, and Transaction ID.
I want to weed out the duplicate records that have ALL FOUR of these fields the same.
I already have this clip of code which does the following :
##-----------------------------------------------------------
## Display output---
## Remove duplicate records (check by field number)
my $key = join',',(split / /)[1, 2, 3, 4, 9];
printf "%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n", $mM, '/',
$Fld[2], $yYYY, ' ', $Fld[3], ':', $Fld[4], ':', $Fld[5], ' ',
$aPPNAME, '_', $sEVERITYCODE, ' AFB-I-XXSSOAMP ', $hOSTNAME,
' Tran(', $tRANS, ') Cat(', $cATEGORY, '):', $mESSAGE . $mISSCODE
## Print record only if nonduplicate
unless $hash{$key}++;
Here is what is in $key (example):
Jul,02,15:58:50,us97udp001ampfb.test.ampf.com,trans(1945588)[159.202.168.7]:
The problem is, as the code is currently written, it is only weeding out records that have different Trans ID.
If the Date, Time or Server is different, the record is not passed. I want only records to be skipped if all 4 of these are identical.
Is there an obvious solution I am not seeing?
If I have left information out that is needed, just ask- thanks for any help.
Jeffpas
Perl newbie here. I have a conundrum that may be fairly simple to a veteran, but it is causing me grief.
What I have is four fields- Date, Time, Server Name, and Transaction ID.
I want to weed out the duplicate records that have ALL FOUR of these fields the same.
I already have this clip of code which does the following :
##-----------------------------------------------------------
## Display output---
## Remove duplicate records (check by field number)
my $key = join',',(split / /)[1, 2, 3, 4, 9];
printf "%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n", $mM, '/',
$Fld[2], $yYYY, ' ', $Fld[3], ':', $Fld[4], ':', $Fld[5], ' ',
$aPPNAME, '_', $sEVERITYCODE, ' AFB-I-XXSSOAMP ', $hOSTNAME,
' Tran(', $tRANS, ') Cat(', $cATEGORY, '):', $mESSAGE . $mISSCODE
## Print record only if nonduplicate
unless $hash{$key}++;
Here is what is in $key (example):
Jul,02,15:58:50,us97udp001ampfb.test.ampf.com,trans(1945588)[159.202.168.7]:
The problem is, as the code is currently written, it is only weeding out records that have different Trans ID.
If the Date, Time or Server is different, the record is not passed. I want only records to be skipped if all 4 of these are identical.
Is there an obvious solution I am not seeing?
If I have left information out that is needed, just ask- thanks for any help.
Jeffpas