#!/usr/bin/awk # tells the distance between too dataset # computes the proportion of item in $1 relatively to $2 BEGIN{ FS="\t" } { commun = 0 l1 = split($1, tab1, " "); l2 = split($2, tab2, " "); for (i in tab1) for (j in tab2) if (tab1[i] == tab2[j]) commun ++ print commun / l2 }