Drop common lines at head/tail of a large set of files

Hi! I have a large set of pairs of text files (each pair in their own subdirectory) and each pair shares head/tail (a couple of first and last lines) but differs in the middle part. I need to delete the heads/tails and keep only the middle portions in which they differ. The lengths of heads/tails are not the same (in terms of number of lines) for different pairs. Do you know an easy way to delete all the heads (tails) at once for all the files? Thanks a lot in advance!

At least you have to know how many lines or to recognize what lines to remove.

What have you tried so far?

Regards