Hello,

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


In reply to Best way to compare two files by sparkel

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.