awk 'FILENAME==ARGV[1] {a[$1]=$1;next} !($1 in a){p[$1 " NOT in file1"]=$1 " NOT in file1"} FILENAME==ARGV[2] {b[$1]=$1;next} !($1 in b) {p[$1 " NOT in file2"]= $1 " NOT in file2"} FILENAME==ARGV[3] {c[$1]=$1;next} !($1 in c){p[$1 " NOT in file3"]=$1 " NOT in file3"} FILENAME==ARGV[4] {d[$1]=$1;next} !($1 in d){p[$1 " NOT in file1"]=$1 " NOT in file1"} END{for(u in p){print p}}' file*
Output will be as follows.
aaa NOT in file2
aaa NOT in file3
eee NOT in file1
ddd NOT in file2
ccc NOT in file2
echo common line: $(comm -12 file1 file2 | comm -12 - file3)
common line: bbb
coerdtr@RudisPC:/mnt/9/playground$ for i in 1 2 3; do echo file$i doesn\'t have $(sort -u file[1-3] | comm -23 - file$i); done
file1 doesn't have eee
file2 doesn't have aaa ccc ddd
file3 doesn't have aaa eee
$ find topdir -type f | xargs cksum -n99 | sort | while read c s n
do
if [ "$c $s" = "$csl" ]
then
echo "$csn$c $s $n"
csn=''
else
csn="$c $s $n
"
fi
csl="$c $s"
done | pg