如何在MacOS上将尖括号中的字符串转换为大写?

如何在MacOS上将尖括号中的字符串转换为大写?,macos,sed,substitution,gnu-sed,Macos,Sed,Substitution,Gnu Sed,我在MacOS 10.12中工作,我有100个这样的文件: My file <structure_is> like this <and_maybe_like> this, but not quite like this. But there might be <stuff> like this, too. 我的文件是这样的, 但不是这样。 但也可能有类似的情况。 我一直在尝试将中的所有项目转换为大写,以查看文件的外观如下: My file <STRU

我在MacOS 10.12中工作,我有100个这样的文件:

My file <structure_is> like this <and_maybe_like> this,
but not quite like this.
But there might be <stuff> like this, too.
我的文件是这样的,
但不是这样。
但也可能有类似的情况。
我一直在尝试将中的所有项目转换为大写,以查看文件的外观如下:

My file <STRUCTURE_IS> like this <AND_MAYBE_LIKE> this,
but not quite like this.
But there might be <STUFF> like this, too.
我的文件是这样的,
但不是这样。
但也可能有类似的情况。
我尝试使用:

find . -name "\*" | xargs sed 's/\<([a-z_][^>]*)\>/\U&/g'
find-名称“\*”| xargs sed's/\]*)\>/\U&/g'
我还尝试过使用gsed(自制):

find-名称“\*”| xargs gsed's/\]*)\>/\U&/g
但我得到的只是文件本身的内容

我该怎么做


最亲切的问候

这在Linux上有效:
sed's/]*>/\U&/g'文件

我不知道
\U
是否仅用于GNU

或者,perl:

perl -pe 's/<.*?>/\U$&/g' file
perl-pe的//\U$&/g”文件
是的。试试sed--posix…
perl -pe 's/<.*?>/\U$&/g' file