hi, plz tel me how two compare a two files in perl, Ignore whitespace only compare the written satements.....
File::DirCompare
Collapse
X
-
Code:use File::DirCompare; # Simple diff -r --brief replacement use File::Basename; $dir1 = shift; $dir2 = shift; # print "Directories to be searched are $dir1 $dir2 \n"; open APPEND_VSS_UNIQUE_FILE, ">>/perl/test/unique_VSS.txt" or die "Cannot Open File: $!"; open APPEND_PERFORCE_UNIQUE_FILE, ">>/perl/test/unique_Perforce.txt" or die "Cannot Open File: $!"; open APPEND_COMMON_DIFFERENT_FILE, ">>/perl/test/common_different_VSSAndPerforce.txt" or die"Cannot Open File: $!"; open APPEND_COMMON_SIMILAR_FILE, ">>/perl/test/common_similar_VSSAndPerforce.txt" or die "Cannot Open File: $!"; File::DirCompare->compare($dir1, $dir2, sub { my ($a, $b, $fg) = @_; if (! $b) { print APPEND_VSS_UNIQUE_FILE $a, "\n"; # printf "Files unique Only in $dir1: %s\n", basename($a); print "Files unique Only in $dir1: $a \n"; } elsif (! $a) { print APPEND_PERFORCE_UNIQUE_FILE $b, "\n"; # printf "Files unique Only in $dir2: %s\n", basename($b); print "Files unique Only in $dir2: $b \n"; } elsif($fg == 1) { print APPEND_COMMON_DIFFERENT_FILE "$a\||$b\n"; print "Files $a and $b are common and different\n"; } elsif($fg == 0) { print APPEND_COMMON_SIMILAR_FILE "$a\||$b\n"; print "Files $a and $b are common and similar\n"; } }); close APPEND_VSS_UNIQUE_FILE; close APPEND_PERFORCE_UNIQUE_FILE; close APPEND_COMMON_DIFFERENT_FILE; close APPEND_COMMON_SIMILAR_FILE;Comment
-
pls sir, am not jocking... plzzzzzOriginally posted by KevinADChehehe... you and your clone have fun, I see you don't really need any help, your just entertaining yourself. Sort of like forum masturbation I guess. :)
Code:use File::DirCompare; # Simple diff -r --brief replacement use File::Basename; $dir1 = shift; $dir2 = shift; # print "Directories to be searched are $dir1 $dir2 \n"; open APPEND_VSS_UNIQUE_FILE, ">>/perl/test/unique_VSS.txt" or die "Cannot Open File: $!"; open APPEND_PERFORCE_UNIQUE_FILE, ">>/perl/test/unique_Perforce.txt" or die "Cannot Open File: $!"; open APPEND_COMMON_DIFFERENT_FILE, ">>/perl/test/common_different_VSSAndPerforce.txt" or die"Cannot Open File: $!"; open APPEND_COMMON_SIMILAR_FILE, ">>/perl/test/common_similar_VSSAndPerforce.txt" or die "Cannot Open File: $!"; File::DirCompare->compare($dir1, $dir2, sub { my ($a, $b, $fg) = @_; if (! $b) { print APPEND_VSS_UNIQUE_FILE $a, "\n"; # printf "Files unique Only in $dir1: %s\n", basename($a); print "Files unique Only in $dir1: $a \n"; } elsif (! $a) { print APPEND_PERFORCE_UNIQUE_FILE $b, "\n"; # printf "Files unique Only in $dir2: %s\n", basename($b); print "Files unique Only in $dir2: $b \n"; } elsif($fg == 1) { print APPEND_COMMON_DIFFERENT_FILE "$a\||$b\n"; print "Files $a and $b are common and different\n"; } elsif($fg == 0) { print APPEND_COMMON_SIMILAR_FILE "$a\||$b\n"; print "Files $a and $b are common and similar\n"; } }); close APPEND_VSS_UNIQUE_FILE; close APPEND_PERFORCE_UNIQUE_FILE; close APPEND_COMMON_DIFFERENT_FILE; close APPEND_COMMON_SIMILAR_FILE;Comment
-
Hehe. This joke is actually rather funny. I went ahead and reformatted the code to make it potentially useful for someone else, but I suspect that this is possibly just the module author given that it's only in version .02.Originally posted by KevinADChehehe... you and your clone have fun, I see you don't really need any help, your just entertaining yourself. Sort of like forum masturbation I guess. :)
cpan File DirCompare
Anyway, I deleted the other thread as a duplicate post. That makes it a night for me.
Twinkle Twinkle...
- MillerComment
-
Originally posted by sunilmukipls sir, am not jocking... plzzzzz
Code:use File::DirCompare; # Simple diff -r --brief replacement use File::Basename; $dir1 = shift; $dir2 = shift; # print "Directories to be searched are $dir1 $dir2 \n"; open APPEND_VSS_UNIQUE_FILE, ">>/perl/test/unique_VSS.txt" or die "Cannot Open File: $!"; open APPEND_PERFORCE_UNIQUE_FILE, ">>/perl/test/unique_Perforce.txt" or die "Cannot Open File: $!"; open APPEND_COMMON_DIFFERENT_FILE, ">>/perl/test/common_different_VSSAndPerforce.txt" or die"Cannot Open File: $!"; open APPEND_COMMON_SIMILAR_FILE, ">>/perl/test/common_similar_VSSAndPerforce.txt" or die "Cannot Open File: $!"; File::DirCompare->compare($dir1, $dir2, sub { my ($a, $b, $fg) = @_; if (! $b) { print APPEND_VSS_UNIQUE_FILE $a, "\n"; # printf "Files unique Only in $dir1: %s\n", basename($a); print "Files unique Only in $dir1: $a \n"; } elsif (! $a) { print APPEND_PERFORCE_UNIQUE_FILE $b, "\n"; # printf "Files unique Only in $dir2: %s\n", basename($b); print "Files unique Only in $dir2: $b \n"; } elsif($fg == 1) { print APPEND_COMMON_DIFFERENT_FILE "$a\||$b\n"; print "Files $a and $b are common and different\n"; } elsif($fg == 0) { print APPEND_COMMON_SIMILAR_FILE "$a\||$b\n"; print "Files $a and $b are common and similar\n"; } }); close APPEND_VSS_UNIQUE_FILE; close APPEND_PERFORCE_UNIQUE_FILE; close APPEND_COMMON_DIFFERENT_FILE; close APPEND_COMMON_SIMILAR_FILE;
ok sir dont help....Comment
-
Does File::Compare do what you need?Originally posted by ajay mhi, plz tel me how two compare a two files in perl, Ignore whitespace only compare the written satements.....Comment
-
Yet another clone? Or split personality? No ... still the same. (http://www.thescripts.com/forum/thread617209.html )Originally posted by ajay mhi, plz tel me how two compare a two files in perl, Ignore whitespace only compare the written satements.....Comment
Comment