New to sed and trying to get the following done, but completely stuck: I am trying to replace a pattern with sed in the second column. This pattern is occuring multiple times.
I have:
Gene1 GO:0000045^biological_process^autophagosome assembly`GO:0005737^cellular_component^cytoplasm
Gene2 GO:0000030^molecular_function^mannosyltransferase activity`GO:0006493^biological_process^protein O-linked glycosylation`GO:0016020^cellular_component^membrane
I want to get:
Gene1 GO:0000045,GO:0005737
Gene2 GO:0000030,GO:0006493,GO:0016020
So getting rid of all the descriptive parts and use "," as the delimiter. I choose to use sed because I thought to easily recognize the pattern between ^ and `. But instead it removes all first GO terms.
Code:
sed -E 's/(^)'.+'(`)/,/g'
Can someone help me?