I am trying to use sed to replace a sequence of the same characters with the amount of characters in that sequence, but somehow something goes wrong.
I am trying the following:
echo aaabbdd | sed -e 's/a*/'"`wc -m &`/"
But this returns
0bbdd while I would like it to return
I don't really know what exactly goes wrong sed seems to know what to replace and tries to execute the wc command, but somehow wc counts something empty? I am out of ideas of how to solve this problem, can somebody help me?