Replace Help

Hi,
djfksdjk)))) kmmm jfdfjk))))
I want to replace the first ')' after kmmm with #.
The output would be djfksdjk)))) exists jfdfjk#)))

Can anyone help on this?

sed 's/\(kmmm[^)]*\))/\1#/' filename

There are different variants of sed; try different backslash patterns if yours doesn't like \(...\)

If the format of the lines are the same, in the light of the positions of the ")" signs:

sed 's/\(.*[a-z]\))\(.*\)/\1#\2/' file

Regards

echo "djfksdjk)))) kmmm jfdfjk))))" | sed 's/\([a-z]\))/\1#/2'
djfksdjk)))) kmmm jfdfjk#)))