Skip to content

Instantly share code, notes, and snippets.

@weirdbricks
Created September 16, 2014 22:57
Show Gist options
  • Save weirdbricks/b53b0341cd099182d8f2 to your computer and use it in GitHub Desktop.
Save weirdbricks/b53b0341cd099182d8f2 to your computer and use it in GitHub Desktop.
wc replacement in ruby
#!/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