I have a thousand files and I need to verify if they all have exactly the same information in the second column up to a certain number of lines. Below an example. I would like to print the names of the files if the first 5 lines of the second columns of the files file1.txt and file2.txt were not equal. In this case the result should show: "difference between files file1.txt and file2.txt"
file1.txt
jose 50 maria 50 fernando 50 andres 50 martin 30 pablo 30 . . . file2.txt
julia 50 julio 50 alan 50 ruth 50 ana 40 manuel 40 . . .