All pastes #505788 Raw Edit

Unnamed

public text v1 · immutable
·published 2007-05-23 19:08 UTC
rendered paste body
#!/usr/bin/perl

open(FILE, "text5.txt");
open(OUT,">output.txt");

while (<FILE>){

        print "processing $_";
        chomp;
        if($_ =~ /^=/){
                next;
        }
        if($_ =~ /^\s*$/){
                next;
        }
        if($_ =~ /PAGE [0-9]+/){
                next;
        }
        if($_ =~ /CODE/){
                next;
        }
        if($_ =~ /P R O C E D U R E/){
                next;
        }
        $code = substr($_,0,11);
        $code =~ s/\s+$//;
        $description = substr($_,22,30);
        $description =~ s/'//g;
        $amount = substr($_,53,8);
        $amount =~ s/^\s+//;

        if($code =~ /^\s*$/){
                next;
        }
        if($description =~ /^\s*$/){
                next;
        }

        $sql = <<END;
INSERT INTO "MWPRO" VALUES( '$code', '$code', '$code', 'A', '$description', NULL, NULL, NULL, NULL, 0, 'A', False, NULL, NULL, 0, 0, $amount, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, False, False, False, NULL, False, NULL, NULL, NULL, NULL, 'SONIA', '2007-05-23', False, False, NULL, NULL, 0, '2007-05-23 14:49:29', False, 0, NULL, NULL, False, False );
END

        print OUT "$sql\n";
        print "$sql";

}

close(FILE);
close(OUT);