Complex Compare

Hi All,

File1.txt

File2.txt

Above are the two input file's:
Always I use to get three rows for File1.txt
File1.txt (fixed width) 2nd line i will get date and 3rd record i will get a number.
File2.txt (Pile delimeter) will contains 'n' number of records were header & footer is fixed.

I need to verify both the below feilds values are same or not?
File1.txt 2nd record date -> File2.txt only header record 3rd column will contains the date
File1.txt 3rd record number -> File2.txt last record number

Thanks in Advance

Try:

awk -F\| 'NR==2{d=$0;next}NR==3{n=$0;next}NR>1&&FNR==1&&$3==d{p=1}END{sub(".","");if (p&&$0==n) {print "same fields"}else{print "different fields"}}' file1.txt file2.txt
1 Like

Any help on this how to proceed...

What do you mean? Is my code not working for you?

Its working fine thanks a lot...