Uma maneira de fazer isso:
sed -ne '1,/^TLR/p' a.txt > 1.txt
sed -ne '1,/^TLR/p' b.txt >> 1.txt
sed -e '1,/^TLR/d' a.txt > 2.txt
sed -e '1,/^TLR/d' b.txt >> 2.txt
Isto é:
-
Imprima as linhas de
a.txtaté corresponder a/^TLR/e criar1.txt -
Imprima as linhas de
b.txtaté coincidir/^TLR/e anexar a1.txt -
Solte as linhas de
a.txtaté corresponder a/^TLR/e criar2.txt -
Solte as linhas de
b.txtaté coincidir/^TLR/e acrescentar a2.txt