/
githubmirror
/
gawk
Обзор
Документация
Войти
/
githubmirror
/
gawk
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
test/longwrds.awk
27 строк
587 B
Arnold D. Robbins
Doc updates. Strftime fix for PC. Check ranges in REs.
29 ноя 2010, 23:03
29 ноя 2010, 23:03
da212dd
Код
Авторство
О чём код?
# 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++) { tmp = tolower($i) if (0 != (pos = match(tmp, /([[:lower:]]|-)+/))) used[substr(tmp, pos, RLENGTH)] = 1 } } #Find a number of distinct words longer than 10 characters END { num_long_words = 0 for (x in used) if (length(x) > 10) { ++num_long_words print x | SORT } print(num_long_words, "long words") | SORT close(SORT) }