Make the `diff` command look only for differences from a specified range of lines

Solution 1:

diff <(sed -n 'S1,S2p' file1) <(sed -n 'S3,S4p' file2)

where

  • S1 is start line file1.
  • S2 is end line file1.
  • S3 is start line file2.
  • S4 is end line file2.

Skipping line 1-4:

diff <(sed -n '5,10p' file1) <(sed -n '5,10p' file2)

$ more file1
1
2
3
4
5
6
7
8
9
10

$ more file2
11
2
3
4
5
65
7
8
9
10

Result

2c2
< 6
---
> 65

-> it skipped the diff on line 1.

It might be easier to use a desktop tool for this. Meld is excellent ( topic on AU: https://askubuntu.com/a/2947/15811 ):

Meld is a visual diff and merge tool targeted at developers. Meld helps you compare files, directories, and version controlled projects. It provides two- and three-way comparison of both files and directories, and has support for many popular version control systems.