home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
rbemx144.zip
/
ruby-1.4.4
/
sample
/
occur2.rb
< prev
next >
Wrap
Text File
|
1998-01-16
|
277b
|
17 lines
# word occurrence listing
# usege: ruby occur2.rb file..
freq = {}
while gets()
for word in $_.split(/\W+/)
begin
freq[word] = freq[word] + 1
rescue
freq[word] = 1
end
end
end
for word in freq.keys.sort
printf("%s -- %d\n", word, freq[word])
end