leprushka has asked for the wisdom of the Perl Monks concerning the following question:

Hi, Ive problems with comparing two files (line by line), which either have a different value in one of the column or the whole line is missing. File 1: # KB0001 21 K UWXKKSJ 0.3666 # KB0001 22 K UWXKKSJ 0.4666 # KB0001 23 K UWXKKSJ 0.5666 # KB0001 24 K UWXKKSJ 0.6266 # KB0001 25 K UWXKKSJ 0.7666 # KB0001 26 K UWXKKSJ 0.8666 # KB0001 27 K UWXKKSJ 0.9666 File2: # KB0002 21 K UWXKKSJ 0.3666 # KB0002 22 K UWXKKSJ 0.4666 # KB0002 23 K UWXKKSJ 0.5666 # KB0002 24 K UWXKKSJ 0.6666 # KB0002 25 K UWXKKSJ 0.7666 # KB0002 26 K UWXKKSJ 0.8666 In the output i want to print lines which are not in one of the files or ones that value is different Can anybody help me on this one? Thanks in advance

Replies are listed 'Best First'.
Re: comparing 2files
by Bloodnok (Vicar) on Aug 04, 2009 at 12:44 UTC
    Ignoring the format of your post (since it's been mentioned elsewhere), if you are on *NIX, Cygwin or have the UNIX utils installed, diff(1) is most definitely your friend - it can do what you want ... almost by default.

    A user level that continues to overstate my experience :-))
Re: comparing 2files
by Utilitarian (Vicar) on Aug 04, 2009 at 12:49 UTC
    Take a look @ Text::Diff it provides diff functionality via Perl
Re: comparing 2files
by jethro (Monsignor) on Aug 04, 2009 at 12:36 UTC
Re: comparing 2files
by merlponk (Scribe) on Aug 04, 2009 at 14:36 UTC
    If Vim is available, using
    vim -d <file1> <file2>
    displays the diff quite nicely.