On Thursday 18 July 2002 06:57, vins wrote: > Hi.... > I've just made this script to update a binary file for my BIND 9 DNS > server. > > ======================= > $WorkFile = "domains/db.nom.za"; > $buffer = file($WorkFile); > > $DBfile = implode($buffer, ""); > $DBfile = ereg_replace("$domain.nom.za. IN NS $fqdnold.", > "$domain.nom.za. IN NS $fqdnnew.", $DBfile); > $DBfile = ereg_replace("$domain.nom.za. IN NS $fqdnold.", > "$domain.nom.za. IN NS $fqdnnew.", $DBfile); > $DBfile = trim($DBfile)."\n"; > > $fp = fopen($WorkFile, 'w'); > fwrite($fp, $DBfile); > fclose($fp); > > ======================= > > Basicall I want to find "dub.domain.com IN NS dns.example.com" and replace > it with "dub.domain.com IN NS dns1.expample.com". Note the '1' and still > maintain the format of the file... > > My script keeps adding and extra line to every line even when I told it to > trim.
Did you even _try_ to do your own debugging before asking the list? You know what the problem is -- extra lines -- so where in your code are you adding extra lines (hint "\n"). -- Jason Wong -> Gremlins Associates -> www.gremlins.com.hk Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * /* "We are on the verge: Today our program proved Fermat's next-to-last theorem." -- Epigrams in Programming, ACM SIGPLAN Sept. 1982 */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php