Skip to content

Instantly share code, notes, and snippets.

@indirect
Created April 1, 2011 18:00
Show Gist options
  • Save indirect/898567 to your computer and use it in GitHub Desktop.
Save indirect/898567 to your computer and use it in GitHub Desktop.
filter the clipboard with a regex
module Kernel
def pbpaste
`pbpaste`
end
def pbcopy(object)
IO.popen('pbcopy', 'w') { |pb| pb << object.to_s }
end
def pbfilter(filter)
pbcopy pbpaste.split("\n").select{|l| l =~ filter }.join("\n")
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment