sparkel has asked for the wisdom of the Perl Monks concerning the following question:
As per your reply, the file comparison should not compare line by line, but it should compare sentences that are different from File 2 to File 1:
Hence even if, "A big bad witch lived inside " is on different lines, it does not appear in the output
I am assuming that even if a line is repeated, since it has already appeared, it is ignored and not printed in the output
Please let me know what you suggest.
Thank you,
Lily
Thank you for your reply. As per your request, here are some samples:
File 1:
On October 31st 2004,
Hansel and Gratel went into the woods
They knocked on a big wooden door
A big bad witch lived inside
File 2:
This is November 1st, 2004
Red riding hood knocked on a big wooden door
A big bad witch lived inside
Oh wait, I think that was a big bad wolf who ate her grandmother
Hence, the file comparison (Finding what is different about File 2 from File 1) should ignore the lines that have dates on them. Hence, the output will be:
Red riding hood knocked on a big wooden door
Oh wait, I think that was a big bad wolf who ate her grandmother
Please suggest,
Thank you
I am a newbie to Perl, please be kind :)
I wanted to know what you felt was the best way I can compare two files.
Hence, except changes in dates (i.e. Ignoring lines that have dates like October 10th, October 31st etc.) , I want to grab all other different lines between the two files that I find.
Please suggest,
Thanks,
Lily
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Best way to compare two files
by sunadmn (Curate) on Nov 01, 2004 at 13:40 UTC | |
|
Re: Best way to compare two files
by Grygonos (Chaplain) on Nov 01, 2004 at 13:51 UTC | |
|
Re: Best way to compare two files
by zentara (Cardinal) on Nov 01, 2004 at 13:42 UTC | |
by radiantmatrix (Parson) on Nov 01, 2004 at 15:02 UTC | |
by zentara (Cardinal) on Nov 02, 2004 at 12:57 UTC | |
|
Re: Best way to compare two files
by Grygonos (Chaplain) on Nov 01, 2004 at 15:32 UTC | |
|
Re: Best way to compare two files
by Hena (Friar) on Nov 01, 2004 at 14:11 UTC |