hi every one,

i want a code for compare between 2 text files A.txt and B.txt

all record in file B.txt includes in file A.txt but with different value.

the digits with color red are accounts and the digits with color blue are values.

i want to compare between A.txt and B.txt based on accounts,when find the accounts from B.txt in A.txt copy the full record for these accounts from A.txt and print it in new file C.txt
===============================================
File A.txt:
ABC20100317201000000 -----> Header
D1503320006980000000
D1629040003540000000
D6284870002570000000
D9517420006980000000
D3561540003540000000
D7513590002570000000
T0000000000000000000 -----> Trailer
===============================================
File B.txt:
ABC20100314201000000 -----> Header
D1503320002180000000
D1629040006930000000
D6284870007250000000
T0000000000000000000 -----> Trailer
===============================================
the output in C.txt as the following:
1-copy the header from A.txt and print it in C.txt
2-copy the record for the accounts that generate from compare operation from A.txt and print it in new file C.txt
3-copy the trailer from A.txt and print it in C.txt
4-leave on line blank in the end of the file C.txt
===============================================
ABC20100317201000000 -----> Header
D1503320006980000000
D1629040003540000000
D6284870002570000000
T0000000000000000000
===============================================
i hope i get help from you.
thank you.