Esta é uma solução usando o Awk:
#!/usr/bin/awk -f
NR == 1 {
# Get the headers on the first line.
# Will be done for both files, but we don't mind.
head[1] = $1;
head[2] = $2;
}
NR == 3 {
# For the third line, go though the data in both columns...
for (i = 1; i <= 2; ++i) {
# If there's something in col[], then this is the second file.
if (col[i]) {
# This is the second file.
# Test the value of the column against what was in the first file.
if (col[i] == $i) {
printf("%s is matching. ", head[i]);
} else {
printf("%s is not matching. ", head[i]);
# Flag that we need to print extra info later.
check = 1;
}
} else {
# This is the first file.
# Remember the data in the two columns.
col[1] = $1;
col[2] = $2;
# Reset the record (line) counter.
NR = 0;
# Skip to the second file.
nextfile;
}
}
if (check) {
printf("Please check.");
}
printf("\n");
}
Teste:
$ ./script.awk file1 file2
NAME is not matching. OPEN_MODE is matching. Please check.