(untested)use strict; my @all_files = </export/home/*_01day>; # angle brackets around a bareword path pattern returns all matchi +ng file names my %macs_found; for my $path ( @all_files ) { my $file = $path . ":"; $file =~ s{.*/}{:}; # now it's ":*_01day:" unless ( open( FILE, $path )) { warn "open failed on $path: $!\n"; next; } while (<FILE>) { chomp; $macs_found{$_} .= $file unless $macs_found{$_} =~ /$file/; } close FILE; } # Now for each mac value, see how many files had it: my $nfiles = scalar @all_files; for my $mac ( sort keys %macs_found ) { if ( split( /::/, $macs_found{$mac} ) == $nfiles ) { print "$mac found in all $nfiles input files\n"; } }
In reply to Re: Comparing files
by graff
in thread Comparing files
by dannyp
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |