In this question I asked how to do this but the special case of capitalization led to a solution that is also special case because it allows the use of /u. So here I ask more generally. I discovered that I have to use this with different cases, not only capitalization.
Using sed, how to change the letter ‘a’ to ‘cool’ but only if it appears repeated as two or more consecutive letters. Example, from:
galaxy
ear
aardvak
Haaaaaaaaa
into
galaxy
ear
coolcoolrdvak
Hcoolcoolcoolcoolcoolcoolcoolcoolcool
Lev got the example right. Prince John gave the general case but got the formula wrong and with one extra step.
After some test and thoughts, merging the two we’ve got:
Test it and tell me, it worked for me.