I have 2 files (A and B), Compare B with A and if the content matches based on a loop, overwrite those contents in A with B.
If B has something like below. The number
'7658763276783' is an unique number to find out this group
HTML Code:
GS**342050359*
ST*820*3420122
REF*TN*7658763276783*TRACE NUMBER FROM
DTM*009*101207
N1*PR*
N1*PE* 19308540
RMR*TN*1190025555**192387.20*192387.20
RMR*TN*0123456666**1*1
DTM*009*101207
SE*000010*342050361
GE**342050359*
In A, I have to search the unique number and find the similar group starting with GS* and ending with GE*. A will be something like
HTML Code:
GS**342050359*
ST*820*3420122
REF*TN*7658763276783*TRACE NUMBER FROM
DTM*009*101207
N1*PR*
N1*PE* 19308540
RMR*TN*1190025555**192387.20*192387.20
RMR*TN*1234556668**1*1
SE*000010*3420122
GE**342050359*
GS**342032432*
ST*820*3243242
REF*TN*453248389879*TRACE NUMBER FROM
DTM*009*101207
N1*PR*
N1*PE* 19308540
RMR*TN*9749827983***172163*172613
SE*000010*3243242
GE**342032432*
And the output has to be something like below, where the contents in B has be overwritten in the relevant loop in A
HTML Code:
GS**342050359*
ST*820*3420122
REF*TN*7658763276783*TRACE NUMBER FROM
DTM*009*101207
N1*PR*
N1*PE* 19308540
RMR*TN*1190025555**192387.20*192387.20
RMR*TN*0123456666**1*1
DTM*009*101207
SE*000010*342050361
GE**342050359*
GS**342032432*
ST*820*3243242
REF*TN*453248389879*TRACE NUMBER FROM
DTM*009*101207
N1*PR*
N1*PE* 19308540
RMR*TN*9749827983***172163*172613
SE*000010*3243242
GE**342032432*
Not sure if this is possible, I need the right direction to go on this issue..