Change case of n-th letter in a string
With GNU sed
(possibly others)
sed 's/./\U&/3' <<< "$str"
With awk
awk -vFS= -vOFS= '{$3=toupper($3)}1' <<< "$str"
In bash you could do:
$ str="abcdefgh"
$ foo=${str:2} # from the 3rd letter to the end
echo ${str:0:2}${foo^} # take the first three letters from str and capitalize the first letter in foo.
abCdefgh
In Perl:
$ perl -ple 's/(?<=..)(.)/uc($1)/e; ' <<<$str
abCdefgh
Or
$ perl -ple 's/(..)(.)/$1.uc($2)/e; ' <<<$str
abCdefgh