home *** CD-ROM | disk | FTP | other *** search
/ GEMini Atari / GEMini_Atari_CD-ROM_Walnut_Creek_December_1993.iso / files / gnu / gawk213b / longwrds.awk < prev    next >
Encoding:
Text File  |  1993-07-29  |  487 b   |  23 lines

  1. # From Gawk Manual modified by bug fix and removal of punctuation
  2. # Record every word which is used at least once
  3. {
  4.     for (i = 1; i <= NF; i++) {
  5.         tmp = tolower($i)
  6.         if (0 != (pos = match(tmp, /([a-z]|-)+/))) {
  7.             used[substr(tmp, pos, RLENGTH)] = 1
  8.         }
  9.     }
  10. }
  11.  
  12. #Find a number of distinct words longer than 10 characters
  13. END {
  14.     num_long_words = 0
  15.     for (x in used) {
  16.         if (length(x) > 10) {
  17.             ++num_long_words
  18.             print x
  19.         }
  20.     }
  21.     print num_long_words, "long words"
  22. }
  23.