in reply to Similarity measurement

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

Replies are listed 'Best First'.
Re^2: Similarity measurement
by Happy-the-monk (Canon) on Apr 19, 2015 at 06:42 UTC

    Not sure who to give credit to... here is the source

    Credit goes to mu, the source says.

    Cheers, Sören

    Créateur des bugs mobiles - let loose once, run everywhere.
    (hooked on the Perl Programming language)