Dɑv*_*vïd 5 perl shell-script regular-expression unicode
我有混合语言的文本文件,想计算其中一种语言的可打印字符的简单总数。语言位于不同的 unicode 范围内是有帮助的。
我的具体用例涉及希伯来语、多调希腊语和英语——但我想这个问题的解决方案也可以推广到其他上下文。
我只想计算希伯来语字符 - 那是 Unicode [\u0590-\u05ff]。这是一个简短的示例输入文件(根据我的手动计数,它包含 62 个希伯来字符):
[ Ps117 ]?
h1: ? ???? ?? ???? ?? ???? ?????? ?? ????? ?
r1: Praise the LORD, all nations! Extol him, all peoples!
g1: ?????????. ??????? ??? ??????, ????? ?? ????, ?????????? ?????, ?????? ?? ????,
b1: Alleluia. Praise the Lord all you nations: praise him all you peoples.
h2: ? ?? ??? ????? ???? ???? ???? ????? ???? ?? ?
r2: For great is his steadfast love toward us; and the faithfulness of the LORD endures for ever. Praise the LORD!
g2: ??? ?????????? ?? ????? ????? ??' ????, ??? ? ??????? ??? ?????? ????? ??? ??? ?????.
b2: For his mercy has been abundant toward us: and the truth of the Lord endures for ever.
Run Code Online (Sandbox Code Playgroud)
如果有帮助,我使用的是 Ubuntu 16.04.2 LTS。我想 perl 在这里可能是一个可能的选择,或者一些 shell 脚本......但我不知道这些东西,这就是我问的原因!
出于好奇,我输入中的行是:h= Hebrew; r= 修订标准版;g= 希腊七十士译本;b= 七十士译本的布伦顿译本;在每种情况下,后跟一个经文编号。