Compare size of one file with other file in Linux

Hi,

I have 32 files for which I want to check size of each file withe other file and if size is same then some action.
Any suggestion to write such script.

Logic:

  1. have list of 32 files
  2. using loop first compare size of one file with remaining 31 ,
  3. do same iteration for each file with other .
    [list=a]
  4. if a==b match found then compare content of files
  5. if both condition satisfies then rename first file as back and create touch file
    [/list]
  6. end.

Thanks

Please show us what you have tried so far.

just i reached to
step 1>

ls -nl CIRTSEG_SP220_*DAT | awk '{print $5,$9}'

where I get file size and name of file.

After this I want to apply loop.

Please use code tags as required by forum rules!

And how would you program that loop? How would you compare files' contents? You didn't mention the system/shell you use. Nor the patterns to use when renaming the files.

Thanks