I want to extract the string like below via the Linux bash tools:XXAAGGHH (XXXXX) ERRTYTUUUIAAAAAAAA ( %%))XX) $@@$&%^&&AADDDDD$ (.SD F@* @) *$%^^&^&&&AA^@%%^^ ()[))DS((]) RTTYUUThe extracted resolution should be:XXXXX  %%))XX.SD F@* @)[))DS((]unfortunately, I could not adopt substr for the string lengthes are not fixed.Inside the parentheses, there may be the parentheses(maybe unbalanced), space or tab (actually, those are garbled from UTF-8 but local system could display  ascii only.)The patten for my usage is  ( : space + left parentheses for left boundary. ) : space + right parentheses for right boundary.I have tried awk, sed and grep, but I got fail. Could you  give me a hint ? thank you.
Extract Complex String Inside Parentheses in Linux Bash
bash;awk;sed;grep