Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: remove a comma

by mr_ron (Chaplain)
on Jun 20, 2018 at 22:30 UTC ( [id://1217080]=note: print w/replies, xml ) Need Help??


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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1217080]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (1)
As of 2024-04-24 14:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found