I have two files and I want to compare the first line of file1 to each lines of file2 and once it is done, next compare second line of file1 to each line of file2. So we a match is found, print that line to a new text file.
I tried and getting wired results
this is my code
I have attached the two files also here.
I tried and getting wired results
this is my code
Code:
#!/usr/bin/perl $file1 = 'log.txt'; $file2 = 'log1.txt'; open(FILE1,"<$file1") || die ("Could not open $file!"); open(FILE2,"<$file2") || die ("Could not open $file!"); my $match = 0; my $odd=0; my $even=0; my $n=0; while (($file1line =~ /MISR_AUX_ODD/) && ($file2line=~ /MISR_AUX_ODD/)) { chomp $_; $match++; print "$file1line===$file2line"; } print "$match"; close(FILE1);
Comment