Diff Command
Diff is the command to compare two files line by line. It can also compare the contents of directories. The output includes information about which lines in the files must be changed so that they become identical. If the files match, no output is produced.
Each change command contains the following, from left to right:
The line number or range of lines in the first file.
A special change character.
The line number or range of lines in the second file.
The change character can be one of the following:
a- Add the lines.c- Change the lines.d- Delete the lines.

The lines are numbered as below
File1
1.Gujarat
2.Ahamedabad
3.Bihar
4.UP
5.AP
6.Punjab
File 2
1.Tamilnadu
2.Gujarat
3.Bihar
4.Orissa
5.Kerala
6.UP
7.AP
8.Mumbai
File1 has to make changes with respect to File2 to make File1 identical to File2.
0a1:- Add line 1 from File2 after the line0 in File1.
2d2:- Delete the second line from File1 to match the 2nd line in File2. The 2 after d means that if the line in the File1 is not deleted it will appear on the line 2 in File2.
3a4,5:-Add lines 4&5 from File2 after the line 3 in File1.
6c8:-Replace the line 6 of File1 with line 8 in File2.

Another Example

0a1:-Add the Line 1 from Linux2 after the Line 0 in Linux1
2d2:- Delete the 2nd Line from Linux1 to match with the Line 2 of Linux2 .The 2 after d means that if the line in the Linux1 is not deleted it will appear on the line 2 in Linux2.
4c4,5:-Replace the line 4 from Linux1 with Line 4-5 from Linux2.
