find * -name '*.dtd' | xargs md5sum > /tmp/dtdmd5s.txt perl -ple 's{([^*]*) [*](.*/)([^/]*)$}{$2$3 $3 $1}' /tmp/dtdmd5s.txt | \ sort -k2 | uniq -c -f 1 | \ perl -nle '@a=split;if($a eq $a[2]){print $b;print}$b=$_;$a=$a[2]'