Thread Datei aufrufen (6 answers)
Opened by Henri at 2015-04-03 16:35

Gast wer
 2015-04-07 17:14
#180604 #180604
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
use strict;          
use warnings;        
use File::Compare;   


my %exclude;         
my $file1 = $ARGV[0] || die 'No file 1';
my $file2 = $ARGV[1] || die 'No file 2';
my $txtdatei = $ARGV[3] || 'No file 3';

my $compare = compare($file2, $file1);
   
open my $file, '<', $file1 or die $!; 
while (<$file>) {
  chomp;             
  $exclude{$_}++;    
}


open my $txtfh, '>', $txtdatei or die $!;  

open $file, '<', $file2 or die $!;
                                                            
while (<$file>) {
  chomp;            
  if($compare == 1){   
  
  #print $txtfh "False! the files are not equal \n";    
 
  print $txtfh "FALSE! $_\n" unless $exclude{$_};             
                                                       

  }
  elsif($compare == 0){ 
             
  print $txtfh "True! the Files are equal \n";         
  }
}
close $txtfh;

Last edited: 2015-04-07 17:31:20 +0200 (CEST)

View full thread Datei aufrufen