I need to compare the column 1 of file 1 with the column 1 of file2 in my script, if the column 1 of file1 matches with the column 1 of file2, then only it should proceed further ,else exit.
I'm with the below code, but it's not giving me the desired result:
if awk 'NR==FNR{c[$1]++;next};c[$1] > 0' /path/abc/example.log /path/abc/example2.log
then
//perform some actions//
else
exit 1
fi
Input data:
file1:
77 abc 20000200 FAILED 10-10-2018 03:37:36
94 hgu 20000126 FAILED 10-10-2018 03:37:34
file2:
77 abc 20000200 FAILED 10-10-2018 03:37:36
In the above sample data, column 1 of file1 doesn't match with the column 1 of file2, so in this case, it should exit.
Hope i'm clear.
Best Answer