Hello all,

i am executing grep command from php to get listing of files
containing searched phrase....
i am getting output like this:

a/x.txt a/y.txt b/z.txt

I am unable to find any way to replace spaces for \n character using
ereg_replace(), I tried to replace / instead and it replaced it in
last filepath...so i am wondering..am I getting output in one "line"?
Or what?

I was also considering PassThru() but it is not suitable for my needs,
because it generates binary data.

Can anyone help me please?

I have RedHat as webserver, so linux environment :)
source is here:

<?
$search="text"   //what are we looking for
$where="dir"     //which directory of site we are searching in

$com="grep -lr ".$search." ".$where."*"; //setting up command

$output=system($com); //executing command
echo ereg_replace(" ", "\n", $output);
?>


-- 
Best regards,
 Martin                          mail   [EMAIL PROTECTED]
                                 mobile +421.907.303.393
                                 icq    34358414
                                 www    http://www.corwin.sk

PGP key fingerprint  21365ca05ecfd8aeb1cf19c838fff033

"In those days spirits were brave, the stakes were high, 
 men were real men, women were real women and small furry 
 creatures from Alpha Centauri were real small furry creatures 
 from Alpha Centauri."

                                        by Douglas Adams


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to