You can do this with awk:
$ awk '{gsub(/,/, "\t" $NF "\n");print}' input
In this case, we simply replace the comma with the tab combined with the last field ( NF stores the number of record fields; $NF gets the NFth field), combined with a new line. Then print the result.
It can be solved with sed too, similarly, but IMHO is a little better than Jonathan's solution (which is rather complicated, I should notice).
sed -n ' :BEGIN h s/,.*<TAB>/<TAB>/ p x s/^[^,]*,// t BEGIN' input
Here we define the label at the beginning of the script:
:BEGIN
Then we copy the contents of the template space to the hold space:
h
Now we replace everything from the first comma to the tab with only the tab:
s/,.*<TAB>/<TAB>/
Print the result ...
p
... and get the contents of the hold space:
x
Since we printed the first line β which contains the first GF:XXX pattern, followed by the last XXR pattern β we will remove the first GF:XXX pattern from the line:
s/^[^,]*,//
If the replacement is done, we insert it at the beginning of the script:
t BEGIN
And everything again applies to the same line, except that now this line no longer has the first GF:XXX pattern. OTOH, if the replacement is not performed, the processing of the current line is performed, and we no longer go to the beginning.