Thread zwei Dateien Vergleichen (11 answers)
Opened by commander at 2012-08-13 13:38

pq
 2012-08-13 16:04
#160877 #160877
User since
2003-08-04
12208 Artikel
Admin1
[Homepage]
user image
grob getestet:
Code (perl): (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
my %results;
open my $fh1, "<", "file1" or die $!;
while (my $line = <$fh1>) {
    chomp $line;
    $results{ $line } = 1;
}
open my $fh2, "<", "file2" or die $!;
while (my $line = <$fh2>) {
    chomp $line;
    my $part = $line;
    $part =~ s/\..*//;
    unless ($results{ $part }) {
        say $line;
    }
}
Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live. -- Damian Conway in "Perl Best Practices"
lesen: Wiki:Wie frage ich & perlintro Wiki:brian's Leitfaden für jedes Perl-Problem

View full thread zwei Dateien Vergleichen