REY619
07-08-2009, 06:25 AM
I have an ASCII file input.sql which contains a database dump. I want that all the 5 lettered words that fall between a left parentheses i.e. ( and a comma i.e. , be replaced by the string (NULL,
I did that with ease in PHP, but in c/cpp, it seems difficult.
Here's the PHP code:
<?php
$blah=file_get_contents("input.sql");
$blah1=preg_replace('/\(.....,/', '(NULL,', $blah);
$blah2=fopen("output.sql", "a+");
fwrite($blah2, $blah1);
?>
Any ideas people? I cant figure it out..
Thanks.
I did that with ease in PHP, but in c/cpp, it seems difficult.
Here's the PHP code:
<?php
$blah=file_get_contents("input.sql");
$blah1=preg_replace('/\(.....,/', '(NULL,', $blah);
$blah2=fopen("output.sql", "a+");
fwrite($blah2, $blah1);
?>
Any ideas people? I cant figure it out..
Thanks.