This program, called akgrep.php, will do a recursive grep through a project, then filter out unwanted lines. Parameters are: * -s The search string * -e String of substrings to identify a line to be excluded. The substrings are separated by "|". The default is in the first line of code, $exclude_str. * The path to the Akelos project. #! /usr/bin/php -e // The -e parameter may be omitted if the default $exclude_str is acceptable. $exclude_str = 'log|.svn|~|compiled'; foreach($argv as $param) { if(substr($param,0,2) == '-e') $exclude_str = substr($param,2); elseif(substr($param,0,2) == '-s') $string = substr($param,2); else $filename = $param; } $excludes = explode('|',$exclude_str); $cmd = "grep -r $string $filename"; unset($result); exec($cmd,$result); while(sizeof($result) > 0) { $line = array_shift($result); $filepos = strpos($line,':'); $filename = substr($line,0,$filepos); foreach($excludes as $exclude){ if(!strpos($filename,$exclude) === false){ $line = ''; } } if(strlen(trim($line)) > 0) echo "$line\n"; } ?>