in reply to Compare 2 files and get data
while (<file1>){ $line1=$_ while(<file2>){ $line2=$_ foreach $field1 in $line1 foreach $field2 in $line2 if $field1 eq $field2{ print $field1 } } } } }
I hope that this pseudocode will help youwhile (<file1> or <file2>){ #The longest of the two files $line1=read ($file1); $line2=read ($file2); foreach $field1 in $line1 foreach $field2 in $line2 if $field1 eq $field2{ print $field1 } } } }
|
|---|