Help with replace all the content within ()

Hi,

Below is my input file :

AAAG(12) TC(14)
AACCCT(66) AACCCT(30) AACCCT(18) AACCCT(48)
TCTG(12) TCTG(20) TCTG(16) AC(12) AC(12) TCTG(16) TCTG(12) AC(12) AC(12) AC(12)
AC(26) AC(14)
AGTG(12) AC(24)
AGTG(12) TCC(12)

Desired output :

AAAG TC
AACCCT AACCCT AACCCT AACCCT
TCTG TCTG TCTG AC AC TCTG TCTG AC AC AC
AC AC
AGTG AC
AGTG TCC

I hope that able to remove whatever inside "()".
Thanks for any advice.

What have you tried?

Try:

perl -pe 's/\(.*?\)//g' file
1 Like

sed -n 's/(..)//gp' file

1 Like

Although this works with the given sample input. The command:

sed 's/([^)]*)//g' file

comes closer to doing what was requested.

1 Like