I have two different files as shown below.
Content of a.txt
:
HDR|1||||||||||
DTL|@|||||||||||
TLR|||||||||||||
HDR|1||||||||||||
DTL|||||||||||||
TLR|||||||||||||
Content of b.txt
:
HDR|2||||||||||
DTL|||||||||||||
TLR|||||||||||||
HDR|2||||||||||||
DTL|last||||||||||||
TLR|||||||||||||
Here I have to take out all the lines till 1st "TLR" in a.txt and b.txt and merge into 1.txt ,same way take out all the lines After 1st "TLR" in a.txt and b.txt and merge into 2.txt
output should be:
Content of 1.txt
:
HDR|1||||||||||
DTL|@|||||||||||
TLR|||||||||||||
HDR|2||||||||||
DTL||||||||||||
TLR|||||||||||||
Content of 2.txt
:
HDR|1||||||||||
DTL||||||||||||
TLR|||||||||||||
HDR|2||||||||||
DTL|last|||||||||||
TLR|||||||||||||
How can we accomplish this using UNIX Script?