summaryrefslogtreecommitdiffhomepage
path: root/tests/scripts/wordfreq.sh
diff options
context:
space:
mode:
Diffstat (limited to 'tests/scripts/wordfreq.sh')
-rw-r--r--tests/scripts/wordfreq.sh6
1 files changed, 5 insertions, 1 deletions
diff --git a/tests/scripts/wordfreq.sh b/tests/scripts/wordfreq.sh
index 31c5eb0..5637c0e 100644
--- a/tests/scripts/wordfreq.sh
+++ b/tests/scripts/wordfreq.sh
@@ -4,7 +4,11 @@ The quick brown fox jumps over the lazy dog.
The dog barks; the fox runs. A quick, quick fox!
TXT
normalize() {
- tr 'A-Z' 'a-z' | tr -c 'a-z\n' ' ' | tr -s ' ' '\n' | sed '/^$/d'
+ # tr's ranges and -c follow the code page's collating order, which on
+ # z/OS (EBCDIC) makes 'A-Z' 'a-z' a mapping into punctuation and
+ # leaves ';' alone. sed and the [:upper:]/[:lower:] classes do not.
+ sed 's/[^a-zA-Z]/ /g' | tr '[:upper:]' '[:lower:]' | tr -s ' ' '\n' |
+ sed '/^$/d'
}
total=0
while read -r w; do