View Single Post
  #8  
Old 08-28-2009, 01:24 AM
AndMetal
Developer
 
Join Date: Mar 2007
Location: Ohio
Posts: 648
Default

Quote:
Originally Posted by bergalas View Post
could we add something to this


to replace || With |NULL|? Im not that good with perl
I believe this will do the trick:

Code:
while(<STDIN>) {
chomp();
s/'/\\'/g;
s/||/|NULL|/g;
@f=split("(?<!\\\\)\\|", $_);
$insert2=join("','",@f);
$#f--;
grep(s/\\\|/\\\\\|/g,@f);
grep(s/"/\\\\"/g,@f);
$statement=sprintf("%s%s','13THFLOOR',now()",$inse rt,$insert2,join('|',@f));
$dbh->do($statement);
printf("Processing: %d %s \r",$f[4],$f[1]);
++$count;
}
__________________
GM-Impossible of 'A work in progress'
A non-legit PEQ DB server
How to create your own non-legit server

My Contributions to the Wiki
Reply With Quote