You need to do: $snr = new File_SearchReplace(...); On Thu, 24 Jun 2004 13:52:55 -0400, Eric L. Sammons <[EMAIL PROTECTED]> wrote: > > First let me thank you for pointing me to PEAR. Now for the problem. Here is > my code: > > <?php > require_once 'File/SearchReplace.php'; > > $serverName = "pxt010"; > $dir = "/home/ossadmin/"; > $file = "server-info.temp"; > > $nfile = "server-$serverName.spec"; > > $ignoreline = array("%", "#"); > > system("sudo /bin/cp $dir$file $dir$nfile", $return); > if (file_exists($dir.$nfile)) { > print "<h3>File exists.</h3>"; > $snr = File_SearchReplace("server-temp", "server-$serverName", > $nfile, > $dir, false, $ignoreline); > $snr -> doSearch(); > } else { > print "<h3>File does not Exist</h3>"; > } > > ?> > > Here is my output: > > File exists. > > Fatal error: Call to undefined function: file_searchreplace() in > /home/els/SrvrBuild/rpl.php on line 15 > > I have tried both include ... and require_once ... with the same result. > > Help? > > Thank you! > >===== Original Message From Justin Patrin <[EMAIL PROTECTED]> ===== > > > >There's a PEAR package for just this. :-) > >http://pear.php.net/package/File_SearchReplace > > > >On Thu, 24 Jun 2004 12:58:08 -0400, Eric L. Sammons <[EMAIL PROTECTED]> wrote: > >> > >> Being new to PHP this task seems to be little out of my reach right now. I > >> wonder if anyone could tell me how, as I read a file, line by line, search > for > >> and then replace a given string? > >> > >> The lines in the file will appear as such: > >> > >> Summary: Some Summary > >> Name: Some-Name > >> Version: x.x > >> . > >> . > >> . > >> > >> Basically I will open the file, read its lines one by one and I want to > >> replace Some-Name with Some-other-Name. > >> > >> Thank you! > >> > >> -- > >> PHP General Mailing List (http://www.php.net/) > >> To unsubscribe, visit: http://www.php.net/unsub.php > >> > >> > > > > > > > > > >-- > >paperCrane --Justin Patrin-- > > > >-- > >PHP General Mailing List (http://www.php.net/) > >To unsubscribe, visit: http://www.php.net/unsub.php > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >
-- paperCrane --Justin Patrin-- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php