10.31.61.230,fall11,Thu 03/30/2011 15:20:46.70 10.31.61.212,spring96,Thu 03/30/2011 15:19:56.89 10.31.61.230,spring96,Thu 03/31/2011 15:40:46.70 10.31.61.230,winter11,Thu 03/31/2011 15:40:46.70 Because IP will change and hostname can be change too because it has different windows OS How do i get new log with the latest info ? like latestip.txt Now 10.31.61.230,fall11,Thu 03/30/2011 15:20:46.70 change hostname the next day so i have to keep new hostname and ip address 10.31.61.230,winter11,Thu 03/31/2011 15:40:46.70 If we have IP change from 10.31.61.212,spring96,Thu 03/30/2011 15:19:56.89 to 10.31.61.230,spring96,Thu 03/31/2011 15:40:46.70 then keep the new IP address and hostname 10.31.61.230,spring96,Thu 03/31/2011 15:40:46.70 so it will create new file and this new log latestip.txt will be 10.31.61.230,winter11,Thu 03/31/2011 15:40:46.70 10.31.61.230,spring96,Thu 03/31/2011 15:40:46.70 #### #viewip.pl #print "content-type: text/html\n\n"; use Time::Local; $today = timelocal(localtime); $datafile=`cat ../hosts/iplist.txt | sort -r | sort -u -t ',' -k 2,2 > ../hosts/latestip.txt`; my $count = 0; open (DATA,"/home/myplace/hosts/latestip.txt") || die ("Can't Open data File \n"); @data=; close DATA; &header_response; $x=0; foreach $line (@data) { $x++; ($ip, $hostname , $datetime)=split(/\,/,$line); print "$hostname$ip $datetime  \n"; $count++; } &footer_response; #################################################################################################### sub header_response { print "Content-type: text/html\n\n"; print "test\n"; print "\n"; print qq^\n^; print "

Our IP Info

\n"; print "
\n"; print "\n"; print "
\n\n"; return; } sub footer_response { print "
Host Name
IP address
Last Boot Windows
\n"; print "



\n"; print " \n"; return; }