reformatting table with various copy paste
I have something like this in a file:
00550 Peptidoglycan biosynthesis (2)
K01000
K02563
00511 Other glycan degradation (6)
K01190
K01191
K01192
K01201
K01227
K12309
I need something like this :
K01000,00550,Peptidoglycan biosynthesis (2)
K02563,00550,Peptidoglycan biosynthesis (2)
K01190,00511, Other glycan degradation (6)
K01191,00511, Other glycan degradation (6)
K01192,00511, Other glycan degradation (6)
K01201,00511, Other glycan degradation (6)
K01227,00511, Other glycan degradation (6)
K12309,00511, Other glycan degradation (6)
How I can do that in linux?