perl -000 -ne '$.=$a+1 and print "$.: doubled <$1> in\n$_\n" if /\b(\w+)\b\s+\b\1\b/gi;$a+=tr/\n//' file