Here is a dirty little trick that lets you pipe output from grep, sed, awk, perl, etc. into your PHP scripts

#!/usr/local/bin/php -q

$fp = fopen('/dev/stdin','r+');
$n = 1;
    $line = trim(fgets($fp,4096));
     // do stuff to line here
     echo $n.' ==> '.$line."\n";


Now you can do something like this: "ls -alF | output.php" after you have "chmod +x outputl.php"

This is extremely useful when you need to do log processing, etc. on different boxes and you may need to parse it differently on each box. You can merely cat file.txt | output.php and presto you have output to stdout.