in reply to Comparing two columns
e.g. file1 contains column1, file2 contains column2 data, type the following on the command line.
The result.txt file contains the values that are present in both files. (we remove the repeating lines with the sort and uniq) or you can use it inside the program, like thissort file1 > file1.sorted sort file2 > file2.sorted comm -12 file1.sorted file2.sorted | sort | uniq > result.txt
Now the $result contains the identifiers that are common to both files but are not repeated.system ("sort file2 > file2.sorted"); system ("sort file1 > file1.sorted"); my $result = `comm -12 file1.sorted file2.sorted | sort | uniq`;
perliff
----------------------
-with perl on my side
|
|---|