http://qs1969.pair.com?node_id=1217080


in reply to remove a comma

You could also try fixing on a later step. Put the following small Perl script into chop-sql-comma.pl:

my $sql = do {local $/; <>}; $sql =~ s/\( ([^()]+) \) , \n\)/($1)\n)/x; print $sql;

Then run from a command prompt with perl "edit in place" mode:

C:\Users\...>perl -i.bak chop-sql-comma.pl CUSTOMER_NEW.txt

Update - after some more digging golfed to (again windows cmd prompt):

perl -Mv5.14.0 -i.bak -e^ "local $/;print <> =~ s/\( ([^()]+) \) , \n\)/($1)\n)/xr"^ CUSTOMER_NEW.txt
Ron

Replies are listed 'Best First'.
Re^2: remove a comma
by luupski (Initiate) on Jun 23, 2018 at 05:21 UTC

    Thnx Ron, will give this a run as well