Thread Zwei dateien vergleichen
(6 answers)
Opened by Gast at 2007-07-04 14:05
Dafür kann man ganz gut
![]() Code (perl): (dl
)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 #!/usr/bin/perl use strict; use warnings; use Tie::File; my $file_one = 'Datei1.txt'; my $file_two = 'Datei2.txt'; open my $fh, '<', $file_one or die $!; tie my @lines, 'Tie::File', $file_two or die $!; while( my $line = <$fh> ){ chomp $line; my @words = $line =~ /\b([A-Z].*?)\b/g; for my $word ( @words ){ unless( grep{ $_ =~ /\Q$word\E/ }@lines ){ push @lines, $line; } } } untie @lines; close $fh; OTRS-Erweiterungen (http://feature-addons.de/)
Frankfurt Perlmongers (http://frankfurt.pm/) -- Unterlagen OTRS-Workshop 2012: http://otrs.perl-services.de/workshop.html Perl-Entwicklung: http://perl-services.de/ |