Skip to content

Instantly share code, notes, and snippets.

@eightbitraptor
Created November 12, 2010 15:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eightbitraptor/674247 to your computer and use it in GitHub Desktop.
Save eightbitraptor/674247 to your computer and use it in GitHub Desktop.
select id from blah, and get the output in a form suitable for copying and pasting to other sql statements/arrays etc
#!/usr/bin/env ruby
output = ""
ARGF.each do |line|
next if line.match(/^\+/)
if line.match(/\|\s+(\S+)/)
output << ($1 + ",")
end
end
STDOUT.puts output.chomp(',')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment