dilip_val has asked for the wisdom of the Perl Monks concerning the following question:
Hi,
I am trying to compare two files which have content like
/dir1/file1
/dir1/file2
/dir1/file3
with another file which has content like
/dir2/file1
/dir2/file2
/dir2/file3
#! /usr/bin/perl open (IF,"<tst1"); open (IF2,"<tst2"); my(@tst1) = <IF>; my(@tst2) = <IF2>; my ($i); my ($j); foreach $i (@tst1) { chomp($i); print "$i\n"; foreach $j (@tst2) { chomp($j); print "$j\n"; `diff $i $j > /dev/null`; `echo $?`; } } close(IF); close(IF2);
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: compare two files line by line and perform a diff on each coressponding line
by moritz (Cardinal) on Jun 01, 2010 at 14:56 UTC | |
Re: compare two files line by line and perform a diff on each coressponding line
by jethro (Monsignor) on Jun 01, 2010 at 14:40 UTC | |
by dilip_val (Acolyte) on Jun 01, 2010 at 15:33 UTC | |
Re: compare two files line by line and perform a diff on each coressponding line
by toolic (Bishop) on Jun 01, 2010 at 14:46 UTC | |
Re: compare two files line by line and perform a diff on each coressponding line
by Khen1950fx (Canon) on Jun 02, 2010 at 07:35 UTC | |
Re: compare two files line by line and perform a diff on each coressponding line
by JavaFan (Canon) on Jun 01, 2010 at 14:35 UTC | |
by toolic (Bishop) on Jun 01, 2010 at 14:57 UTC |