Given two files, I want to write a shell script that reads each line from file1 and checks if it is there in file2. If a line is not found in file2 it should keep it lets say in a table TAB1. Also, if there any any additional lines in file2, which are not in file 2 it should keep it lets say in a table TAB2.
The files can contain words numbers or anything. For example :
file1 :
Hi!
1234
5678
1111
hello
file2:
1111
5678
1234
Hi!
hellothere
In this case there should be "hello" in TAB1, and "hellothere" in TAB2
If two files are equal I want to return with "files are equal" echo or something like that.
How can I do this? I've tried experimenting with diff, but without success.
Thanks in advance