output of calling grep lr

From: Date: Thu, 09 Jan 2003 08:54:03 +0000
Subject: output of calling grep lr
Groups: php.general 
Request: Send a blank email to php-general+get-130888@lists.php.net to get a copy of this message
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 corwin@corwin.sk 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

« previous php.general (#130888) next »