find and replace variable

Is there an easy way of doing this

cat file1

jkasjhjgfg LTRIM(RTRIM(aa_bb_cde))
aragsfdg LTRIM(RTRIM(aa_bb_cde)) aregfafdgfg
sdgsfdagdfg  gadfg
eafgsadgsa
asdgsfdgag LTRIM(RTRIM(aa_bb_cde)) rfghsdfhd

I want to replace each occurence of LTRIM(RTRIM($x)) with
LENGTH(LTRIM(RTRIM($x)))=0

So my output file should be

jkasjhjgfg LENGTH(LTRIM(RTRIM(aa_bb_cde)))=0
aragsfdg LENGTH(LTRIM(RTRIM(aa_bb_cde)))=0 aregfafdgfg
sdgsfdagdfg  gadfg
eafgsadgsa
asdgsfdgag LENGTH(LTRIM(RTRIM(aa_bb_cde)))=0 rfghsdfhd
sed 's/\(LTRIM(RTRIM[^)]*))\)/LENGTH(\1)=0/' input_file

Works...thanks Shell!

try this one:)

sed 's/\(LTRIM(RTRIM(\)\(.*\)\())\)/LENGTH(\1\2\3)=0/' filename

Summer_cherry,
Your solution works fine for the given data sample.

Knowing how the posts are here, there is a strong possibility that
the OP could come back to say the solution is not working for another
situation in the file.

Your code will break for the following scenario:

jkasjhjgfg LTRIM(RTRIM(aa_bb_cde)) abcdef LENGTH(SQRT(aa_bb_cde))