projects
/
uwc.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
0951da8
)
uwc: ruby implementation
author
Richard Kojedzinszky
<krichy@tvnetwork.hu>
Mon, 6 Oct 2014 21:23:12 +0000
(23:23 +0200)
committer
Richard Kojedzinszky
<krichy@tvnetwork.hu>
Mon, 6 Oct 2014 21:23:12 +0000
(23:23 +0200)
uwc.rb
[new file with mode: 0644]
patch
|
blob
diff --git a/uwc.rb
b/uwc.rb
new file mode 100644
(file)
index 0000000..
38deebb
--- /dev/null
+++ b/
uwc.rb
@@ -0,0
+1,16
@@
+#!/usr/bin/ruby -w
+
+hash = Hash.new(0)
+
+re = /([a-z']+)/i
+
+$stdin.each do |line|
+ line.scan(re).each do |w|
+ w = w[0]
+ hash[w] = hash[w] + 1
+ end
+end
+
+hash.keys.sort_by! { |x| [hash[x], x] }.each do |w|
+ puts "#{w} #{hash[w]}"
+end