Skip to content

Instantly share code, notes, and snippets.

@dux
Created April 30, 2014 00:40
Show Gist options
  • Save dux/bd9bbe6ddb57d2a6b230 to your computer and use it in GitHub Desktop.
Save dux/bd9bbe6ddb57d2a6b230 to your computer and use it in GitHub Desktop.
colorized grep # memcached -vv 2>&1 | cgrep GET SET # for resoult of http://i.imgur.com/ifnrEj9.png
#!/usr/bin/ruby
require 'colorize'
colors = [:green, :red, :yelow, :blue]
$stdin.each_line do |l|
for el, i in ARGV.each_with_index
next unless l =~ /#{el}/
print l.send(colors[i])
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment