I have four files, I need to compare these files together.
As such i know "sdiff and comm" commands but these commands compare 2 files together. If I use sdiff command then i have to compare each file with other which will increase the codes.
Please suggest if you know some commands whcih can compare more than 2 files
You haven't said much about what you'd like to see. Do you want simply an indication that the files are the same or different? Do you need to know details on a line-by-line basis? Can the file content be reordered?
One could look at the lengths of the files. If they differ in length, then they cannot be the same. If the length is the same, then you could use a check-summing code, say md5sum, to calculate a numeric signature for the files, and then compare all the signatures.
If you want detailed attempts from responders here, then post some representative samples of 4 files, along with how you think the output should be displayed.
Actually my need is that any line in the four files should not be same
e.g.
cat File1
neha
pg
cat file2
aru
arin
cat file3
sample
apple
cat file4
apple
neha
juice
Now a line of file4 is same with file3 and file1. Here i need that command should report that line of file4 is same in file3 and file1
As i want every file should be unique