I need to reformat the kegg reconstruct pathway output, I have something like this in file1:
00550 Peptidoglycan biosynthesis (2)
K01000
K02563
00511 Other glycan degradation (8)
K01190
K01191
K01192
K01201
K01227
K12309
I need something like:
00550 Peptidoglycan biosynthesis (2) K01000 K02563
00511 Other glycan degradation (6) K01190 K01191 K01192 K01201 K01227 K12309
How could I reformat this like that in vim or linux
:g
command. Something like this:g/^0/,/^0\|\%$/-j
, which will mark each line starting with0
and join until the next line starting with0
(or end of line). However, it will miss the last line, so you need to add a final:$-j
command to fix this. Posting here as comment, since question is on hold and answers can't be written