I
IJALAB
Hi All,
Thanks for all the guidance.
I have two files, which are of similar output but logged at different
times. They need to be compared for any changes in the data logged. But
the comparison should start only when the whole line matches. For ex:
I am pasting only few bytes from the log.It is actually 48 bytes wide.
File 1's output:
F0 00 10 00
F0 00 00 00
F0 00 7F 15 - from this point output matches with file2
F0 00 00 01
F0 00 0F FF
F0 00 7F 00
F0 00 FB 5D
F0 00 00 00
file2's output:
F0 00 7F 15
F0 00 00 01
F0 00 0F FF
F0 00 7F 00
F0 00 FB 5D
F0 00 00 00
So, I started like :
open(OUT, ">FileOutput.txt") || die "Can't open output
file.";
open(IN1, "<File1.txt") || die "Can't open input file 1.";
open(IN2, "<File2.txt") || die "Can't open input file
2.";
while (<IN1>) && (<IN2>)
{
foreach $line1(<IN1>)
{
foreach $line2(<IN2>)
{
if ($line1 = $line2)
{
print "Lines match";
}
else
{ print "Lines are not matching";}
}
}
}
but I dont know any better idea to compare the file outputs. Also, any
of these files might have some extra lines.
Any better idea that I can implement in Perl.
Bala
Thanks for all the guidance.
I have two files, which are of similar output but logged at different
times. They need to be compared for any changes in the data logged. But
the comparison should start only when the whole line matches. For ex:
I am pasting only few bytes from the log.It is actually 48 bytes wide.
File 1's output:
F0 00 10 00
F0 00 00 00
F0 00 7F 15 - from this point output matches with file2
F0 00 00 01
F0 00 0F FF
F0 00 7F 00
F0 00 FB 5D
F0 00 00 00
file2's output:
F0 00 7F 15
F0 00 00 01
F0 00 0F FF
F0 00 7F 00
F0 00 FB 5D
F0 00 00 00
So, I started like :
open(OUT, ">FileOutput.txt") || die "Can't open output
file.";
open(IN1, "<File1.txt") || die "Can't open input file 1.";
open(IN2, "<File2.txt") || die "Can't open input file
2.";
while (<IN1>) && (<IN2>)
{
foreach $line1(<IN1>)
{
foreach $line2(<IN2>)
{
if ($line1 = $line2)
{
print "Lines match";
}
else
{ print "Lines are not matching";}
}
}
}
but I dont know any better idea to compare the file outputs. Also, any
of these files might have some extra lines.
Any better idea that I can implement in Perl.
Bala