##
## USED WHEN YOU WANT TO TRAVERSE A LOGFILE AND ELIMINATE ANY DUPLICATE ENTRIES.
##
#!/usr/bin/perl -w
#################################################################################
## Author: BRIAN HUNTER
## Date: 8/10/2020
## Email: brian@sutechy.com
#################################################################################
use strict;
my %seen;
my $logfile="/tmp/messages";
open(FILE, "<$logfile") or die "Unable to open $logfile :$!\n";
while(< FILE>) {
my($domain,$ip,@rest) = split(/\s+/,$_);
next if($seen{$ip}++); # NEXT IF IP IS SEEN
print "ENTRY: $_\n";
}
close(FILE);
exit(0);