Usando perl
(Thx @terdon )
perl -pe 's/(.)(\d+)+/ x /eg'
Ou como função
func () {
perl -pe 's/(.)(\d+)+/ x /eg' <<< ""
}
Exemplo
% perl -pe 's/(.)(\d+)+/ x /eg' <<< "afa5hgt66tt"
afaaaaahgtttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttt
% perl -pe 's/(.)(\d+)+/ x /eg' <<< "errerew9ax66w"
errerewwwwwwwwwaxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxw
% perl -pe 's/(.)(\d+)+/ x /eg' <<< "afa5hgt3tt"
afaaaaahgttttt