Advanced PHP Programming- P4
128
Chapter 5 Implementing with PHP: Standalone Scripts
if($i++ == 10) { break; } } print “\n\n”; } ?
The script works by reading in a logfile on STDIN and matching each line against $regex to extract individual fields.The script then computes summary statistics, counting the number of requests per unique IP address and per unique Web server user agent. Because combined-format logfiles are large, you can output a . to stderr every 1,000 lines to reflect the parsing progress. If the output of the script is redirected to a file, the end report will appear in the file, but the .’s will...