I have a file like this (with much more lines):
01200 Carbon metabolism (1)
01210 2-Oxocarboxylic acid metabolism (1)
01212 Fatty acid metabolism (2)
01230 Biosynthesis of amino acids (1)
00020 Citrate cycle (TCA cycle) (1)
and I want to replace the first and the last space for a tab, like this:
01230\tBiosynthesis of amino acids\t(1)
00020\tCitrate cycle (TCA cycle)\t(1)
I tried the following:
sed 's/ /\t/;s/ (/\t(/' eg_kaas_pwmap > res.tsv
It worked, but in lines as in the line with "(TCA cycle)
", I got the \t
before it, like:
00020\tCitrate cycle\t(TCA cycle) (1).
I tried some modifications, but none of it worked.
What should I do?