How to find duplicates contents in a files by comparing other files?

Hi Guys ,
we have one directory ...in that directory all files will be set on each day..
files must have header ,contents ,footer..

i wants to compare the header,contents,footer ..if its same means display an error message as 'files contents same'

Perhaps try md5sum, e.g...

md5sum -t files* | awk 'a[$1]{printf "%s and %s are the same\n",a[$1],$2;next}{a[$1]=$2}'
1 Like

This will give you the identical files, but no error msg:

md5sum *|sort|uniq -w32 --all-repeated=separate|cut -f3 -d" "
1 Like

md5sum is not installed is there any other ways......

---------- Post updated at 06:01 AM ---------- Previous update was at 06:00 AM ----------

md5sum is not installed is there any other ways..

---------- Post updated at 06:01 AM ---------- Previous update was at 06:01 AM ----------

md5sum is not installed is there any other way

Try sum, cksum, shasum, sha1sum - any check sum creator will do. Try

apropos sum

[Thanks Rudic ..
but its not working if there any other solutions...

What system are you on? And what do you get for this: ls /usr/bin/*sum

Try this - can be lengthy (about 100 times slower than md5sum solution). Works on linux.

for i in *; do for j in *; do if [ $i != $j ]; then diff -sq $i $j 2>/dev/null; fi; done; done|grep identical