Shell Unix中的Sed或String Replace命令将序列后的最后一个字符更改为大写

Shell Unix中的Sed或String Replace命令将序列后的最后一个字符更改为大写,shell,unix,command-line,replace,sed,Shell,Unix,Command Line,Replace,Sed,我基本上有这些xml文件,在这些文件中,我需要在之后更改第一个字母表 例如。 结果: 我试过:sed/sed/\U用于转换所有字符。您需要使用\u来转换第一个匹配项 此外,您还需要对它们进行分组,以确保转换正确的字母: sed 's/\(<structure name=\"\)\(.\)/\1\u\2/' xml-file sed's/\( sed 's/\(<structure name=\"\)\(.\)/\1\u\2/' xml-file

我基本上有这些xml文件,在这些文件中,我需要在之后更改第一个字母表 例如。 结果:


我试过:
sed/
sed/
\U
用于转换所有字符。您需要使用
\u
来转换第一个匹配项

此外,您还需要对它们进行分组,以确保转换正确的字母:

sed 's/\(<structure name=\"\)\(.\)/\1\u\2/' xml-file
sed's/\(
sed 's/\(<structure name=\"\)\(.\)/\1\u\2/' xml-file