#!/usr/bin/perl -w # rtest9.pl $|++; # stdout hot use strict; # avoid d'oh! bugs require 5; # for following modules use Cwd 'chdir'; # move to particular directory use Tie::IxHash; # insertion-order retrieval for hash # my $logDir = '/cygdrive/C/Rsync/logs'; my $logDir = '/home/joe/rtest'; my $allLog = "all.log"; my $errLog = "err.log"; my $dirLog = "dir.log"; my $fileLog = "file.log"; chdir "$logDir"; open ALL, "< $allLog" or die $!; my @all = ; close ALL or die $!; open ERR, "< $errLog" or die $!; my @err = ; close ERR or die $!; tie my %allCount, "Tie::IxHash"; $allCount{$_}++ for( @all, @err ); my (@dirfile, @errchk); for( keys %allCount ) { if ( $allCount{$_} == 1 ) { push @dirfile, $_; } else { push @errchk, $_; } } my (@dir, @file); for(@dirfile){ if ( $_ =~ /\// ) { push @dir, $_; } else { push @file, $_; } } open DIR, "> $dirLog" or die $!; print DIR "$_" for(@dir); close DIR or die $!; open FIL, "> $fileLog" or die $!; print FIL "$_" for(@file); close FIL or die $!; =pod == all.log == file1 file2 error1 error2 file3 dir1/ dir2/ == err.log == error1 error2 =cut