Find changes or differences in 2 text files

Discussion in 'Perl Misc' started by Bill H, Sep 3, 2008.

  1. Bill H

    Bill H Guest

    Is there a simple perlish way (or module) of comparing 2 text files
    (or 2 strings containing their contents) and determining what is
    different between the two? These text files are straight text, not
    data of any type. Something along the lines of Diff without having to
    shell out to it (unless Difff is faster).

    Bill H
     
    Bill H, Sep 3, 2008
    #1
    1. Advertising

  2. On Wed, 03 Sep 2008 11:09:42 -0700, Bill H wrote:

    > Is there a simple perlish way (or module) of comparing 2 text files (or
    > 2 strings containing their contents) and determining what is different
    > between the two? These text files are straight text, not data of any
    > type. Something along the lines of Diff without having to shell out to
    > it (unless Difff is faster).
    >
    > Bill H


    Please try CPAN before asking these kinds of questions. If you did, you
    would have found Text::Diff, which does exactly what you are asking for.

    Regards,

    Leon Timmermans
     
    Leon Timmermans, Sep 3, 2008
    #2
    1. Advertising

  3. Bill H

    Bill H Guest

    On Sep 3, 2:20 pm, Leon Timmermans <> wrote:
    > On Wed, 03 Sep 2008 11:09:42 -0700, Bill H wrote:
    > > Is there a simple perlish way (or module) of comparing 2 text files (or
    > > 2 strings containing their contents) and determining what is different
    > > between the two? These text files are straight text, not data of any
    > > type. Something along the lines of Diff without having to shell out to
    > > it (unless Difff is faster).

    >
    > > Bill H

    >
    > Please try CPAN before asking these kinds of questions. If you did, you
    > would have found Text::Diff, which does exactly what you are asking for.
    >
    > Regards,
    >
    > Leon Timmermans


    Leon

    Thanks for the tip - FYI searching for any variation of:

    Find changes or differences in 2 text files

    Finds nothing on Cpan. The search engine on there is very limited. I
    would need to know what I am looking for to find what I am looking
    for. And if I search for Diff, I get 124 different modules to dig
    through.

    Bill H
     
    Bill H, Sep 3, 2008
    #3
  4. Bill H <> wrote:
    > On Sep 3, 2:20 pm, Leon Timmermans <> wrote:
    >> On Wed, 03 Sep 2008 11:09:42 -0700, Bill H wrote:


    >> > Something along the lines of Diff without having to shell out to
    >> > it (unless Difff is faster).

    ^^^^^^^^^
    ^^^^^^^^^

    Are you coding a high-performance application or expect hundred-Mb
    strings to compare or something?

    "Premature optimization is the root of all evil". (Google it)

    First you want an approach that does what you want it to do.

    Only if the 1st approach proves to be too slow should you
    concern yourself with execution speed.


    >> Please try CPAN before asking these kinds of questions.



    This is some very sage advice. Please don't dismiss it...


    > Thanks for the tip - FYI searching for any variation of:
    >
    > Find changes or differences in 2 text files
    >
    > Finds nothing on Cpan. The search engine on there is very limited.



    It is a keyword search, not a natural language processing search.

    You need to give it a keyword.

    Like "Diff", which you already knew was a relevant keyword.


    > I
    > would need to know what I am looking for to find what I am looking
    > for.



    You did know what you were looking for, you were looking for
    something along the lines of "Diff", so I fail to see the
    relevance of the quote snippet above.


    > And if I search for Diff, I get 124 different modules to dig
    > through.



    FYI, posting here rather than first taking the 5 minutes necessary
    to dig through CPAN results can severely damage your ability to get
    help with future Perl questions.


    --
    Tad McClellan
    email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"
     
    Tad J McClellan, Sep 4, 2008
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ken Webster

    ASP.NET 2003 to 2005 Differences/Changes

    Ken Webster, Jul 26, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    5,163
    Patrice
    Jul 26, 2005
  2. _mario.lat
    Replies:
    1
    Views:
    313
    Alan Krueger
    Jan 21, 2007
  3. Bob
    Replies:
    2
    Views:
    392
  4. Home_Job_opportunity
    Replies:
    0
    Views:
    528
    Home_Job_opportunity
    Jan 8, 2009
  5. Home_Job_opportunity
    Replies:
    0
    Views:
    617
    Home_Job_opportunity
    Jan 14, 2009
Loading...

Share This Page