in reply to Re^3: comparing contents of the file
in thread comparing contents of the file
#!/usr/bin/perl use strict; use warnings; my %lines; open F1, "File.txt"; while(my $result= <F1>) { $lines{$result}=1; } close(F1); open (OF1, ">match.txt"); open (OF2, ">diff.txt"); open F2,"File2.txt"; while(<F2>) { if ($lines{$_} == 1) { print OF1 $lines{$_}; $lines{$_}++; } else { print OF2 $lines{$_}; } } close OF1; close OF2;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: comparing contents of the file
by toolic (Bishop) on Jun 04, 2008 at 16:38 UTC | |
by Ms.Ranjan (Initiate) on Jun 04, 2008 at 21:03 UTC | |
by graff (Chancellor) on Jun 04, 2008 at 23:27 UTC | |
by Ms.Ranjan (Initiate) on Jun 05, 2008 at 20:48 UTC |