<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">#!/usr/bin/perl
# By Andrew McCarthy (andrewmc@netsoc.ucd.ie)
# This program is provided "as is" without any warranty of any kind.
# "If it blows up, don't blame me".
# Feedback welcome.
#
# This script takes a file of the format "lookuptime ip hostname", and
# removes any repeated entries for each ip. The entry output is that
# with the most recent (highest) lookuptime. The output is unsorted.
while(&lt;&gt;){
        chomp;
        ($time,$ip,$name)=split;
        if (exists $h{$ip}) {
                ($oldtime,$oldname)=split(' ',$h{$ip});
                if ($oldtime&lt;$time) { $h{$ip}="$time $name"; }
        }
        else { $h{$ip}="$time $name"; }
}
while(($ip,$temp)=each(%h)){
        ($time,$name)=split(' ',$temp);
        print "$time $ip $name\n";
}
</pre></body></html>