Created
September 16, 2014 22:57
-
-
Save weirdbricks/b53b0341cd099182d8f2 to your computer and use it in GitHub Desktop.
wc replacement in ruby
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/ruby | |
#By Lampros Chaidas | |
#wc replacement in ruby | |
input = $stdin.read | |
words = input.split(" ").count | |
newlines = input.lines.count | |
characters = input.length | |
print "\t#{newlines}\t#{words}\t#{characters}\n" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment