Hi friends!
I have a tab delimited file with two columns :
GB_45_DRB SP:0139466(mrmi sisignm)|SP:3674(fllflg_itoioh)|SP:68954779(RMTKLGF to emmdm-roomto)
GB_45_DRD SP:475928(mgmdksi rikgkg)|SP:587959(roykgl tiic-tm)|SP:0139466(mrmi sisignm)|SP:3674(fllflg_itoioh)|SP:68954779(RMTKLGF to emmdm-roomto)
GB_45_DRCD
GB_45_P5294 SP:3735599(fkkfdlk)
I want to remove all occurences of stuff between brackets(inclusive of brackets) in second column and replace all "|" with ";"
So that it looks like SP:0139466;SP:3674;SP:68954779 in second col. Problem is that second col might be empty, as in third row here.
Ur help would be appraciated..
Thanks
The first example below does the 'eliminate (stuff)' and the second also does the substitution of delimiters.
I thought there would have been a way to use [[:print:]] or [[:graph:]] to select the letters and sumbols inside the (), but I could not get that to work properly.
> echo "GB_45_DRB SP:0139466(mrmi sisignm)|SP:3674(fllflg_itoioh)|SP:68954779(RMTKLGF to emmdm-roomto)" | sed "s/([A-Za-z _\-]*)//g"
GB_45_DRB SP:0139466|SP:3674|SP:68954779
> echo "GB_45_DRB SP:0139466(mrmi sisignm)|SP:3674(fllflg_itoioh)|SP:68954779(RMTKLGF to emmdm-roomto)" | sed "s/([A-Za-z _\-]*)//g" | tr "|" ";"
GB_45_DRB SP:0139466;SP:3674;SP:68954779
>