Need your expert advice on this
AMOUNT,30,/AMOUNT,MESS,Am,/MESS,AMOUNT,30,/AMOUNT,TXN,209,/TXN
MESS,SU,/MESS,TXN,200,/TXN,AMOUNT,70,/AMOUNT
TXN,200,/TXN,AMOUNT,90,/AMOUNT,MESS,SUM,/MESS,AMOUNT,90,/AMOUNT
There is no particular order in which AMOUNT or TXN gets generated but each line has these two value. Also there is a duplicate AMOUNT entry on some rows.
I need an output as below
AMOUNT,30,/AMOUNT,TXN,209,/TXN
AMOUNT,70,/AMOUNT,TXN,200,/TXN
AMOUNT,90,/AMOUNT,TXN,200,/TXN
It will be very helpful if anyone can help me on this.
TXNAMOUNTand/AMOUNTkinda working as a opening and closing "tag" for the value? Can there be multiple values betweenAMOUNTand/AMOUNT(or betweenTXNand/TXN)?