diff options
Diffstat (limited to 'test/longwrds.awk')
-rw-r--r-- | test/longwrds.awk | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/test/longwrds.awk b/test/longwrds.awk index d496ac79..d4b4d92d 100644 --- a/test/longwrds.awk +++ b/test/longwrds.awk @@ -1,4 +1,10 @@ # From Gawk Manual modified by bug fix and removal of punctuation + +# Invoker can customize sort command if necessary. +BEGIN { + if (!SORT) SORT = "LC_ALL=C sort" +} + # Record every word which is used at least once { for (i = 1; i <= NF; i++) { @@ -14,8 +20,8 @@ END { for (x in used) if (length(x) > 10) { ++num_long_words - print x | "LC_ALL=C sort" + print x | SORT } - print(num_long_words, "long words") | "LC_ALL=C sort" - close("LC_ALL=C sort") + print(num_long_words, "long words") | SORT + close(SORT) } |