User Tools

Site Tools


Very simple ruby template for PG

pg.rb
#!/usr/bin/env ruby
 
require 'pg'
 
conn = PG.connect(:dbname => "mail")
res = conn.exec('select * from alias order by id')
 
res.each do |row|
    if row['address'].match('unix7')
       puts row['id'] + "\t" + row['address'].gsub('.pro','.org')
    end
end
 
#EOF

First PagePrevious PageBack to overviewNext PageLast Page