shell – tr [:upper:] [:lower:]用西里尔文本

我正在尝试从俄语短篇小说中提取一个单词列表.
#!/bin/sh

export LC_ALL=ru_RU.utf8

sed -re 's/\s+/\n/g' | \
sed 's/[\.!,—()«»;:?]//g' | \
tr '[:upper:]' '[:lower:]' | \
sort | uniq

然而,这个步骤并不是把西里尔字母大写下来.我以为我是巧妙地使用便携式字符类!

$LC_ALL=ru_RU.utf8 echo "Г" | tr [:upper:] [:lower:]
Г

如果相关,我通过从Chrome浏览器窗口复制粘贴到Vim中获得了俄文本.它看起来正好在屏幕上(Putty终端).这是在Cygwin的bash shell中 – 它应该在Linux上与Bash相同(应该!).

什么是便携式,可靠的方式来缩小管道中的unicode文本?

这是我在 Wikipedia发现的(没有任何参考)):

Most versions of tr,including GNU tr and classic Unix tr,operate on single-byte characters and are not Unicode compliant. An exception is the 07001 implementation,which provides basic Unicode support.

而且,this是老,但相关.

正如我在评论中提到的,sed似乎工作(至少GNU sed):

$echo 'СТЭК' | sed 's/[[:upper:]]*/\L&/'
стэк

相关文章

用的openwrt路由器,家里宽带申请了动态公网ip,为了方便把2...
#!/bin/bashcommand1&command2&wait从Shell脚本并行...
1.先查出MAMP下面集成的PHP版本cd/Applications/MAMP/bin/ph...
1、先输入locale-a,查看一下现在已安装的语言2、若不存在如...
BashPerlTclsyntaxdiff1.进制数表示Languagebinaryoctalhexa...
正常安装了k8s后,使用kubect工具后接的命令不能直接tab补全...