comm comes to mind, but this is a perl forum, so here is a my shot at it, although it is flawed, as permutated lines do not get registered as a difference. Nor do extra repeated lines:
perl -ne '$lines++;$common++ if ($seen{$_} .= @ARGV) =~ /10$/; END{pri +ntf("%.2f",$common/$lines*200)}' file1.txt file2.txt
Not sure who to give credit to... here is the source: http://www.cyberciti.biz/faq/command-to-display-lines-common-in-files/
It extends to 3 files if you use "=~/210$/".
Another way would be parse the output of diff with perl. But Im not getting the correct syntax for that. Edit: Thanks! Here is my own spin:
perl -ne '$lines++;$common++ if ($seen{$_} .= @ARGV) eq "10"; END{prin +tf("%.2f",$common/$lines*200)}' file1.txt file2.txt
In reply to Re: Similarity measurement
by FreeBeerReekingMonk
in thread Similarity measurement
by kennedy
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |