Re: A Question
From: Mladen Gogala <mladen_at_bogus.email.com>
Date: Tue, 2 Jun 2009 18:56:14 +0000 (UTC)
Message-ID: <h03ske$guv$1_at_solani.org>
On Fri, 29 May 2009 11:01:13 -0700, joel garry wrote:
Date: Tue, 2 Jun 2009 18:56:14 +0000 (UTC)
Message-ID: <h03ske$guv$1_at_solani.org>
On Fri, 29 May 2009 11:01:13 -0700, joel garry wrote:
> awk 'BEGIN {print " set verify off echo off feedback off pages 0 heading
> off termout off" ;print "select * from yourdbtable where youridentifier
> in (" } {print "\047" $1"\047"} END
> {print"\047somethingnotpossible\047)"}' < yourfile > yoursqlcommand.sql
It's better written like this:
#!/usr/bin/perl
eval '$'.$1.'$2;' while $ARGV[0] =~ /^([A-Za-z_0-9]+=)(.*)/ && shift;
# process any FOO=bar switches $, = ' '; # set output field separator $\ = "\n"; # set output record separator
print ' set verify off echo off feedback off pages 0 heading off termout
off';
print 'select * from yourdbtable where youridentifier in (';
while (<>) {
($Fld1) = split(' ', $_, -1);
print "\\047" . $Fld1 . "\\047";
}
print "\\047somethingnotpossible\\047)";
It's an output from a2p, minus 2 lines.
-- http://mgogala.freehostia.comReceived on Tue Jun 02 2009 - 13:56:14 CDT