= array(); foreach( file( './apache.log' ) as $line ) { list( , , , , , , , , $status, $bytes ) = explode( ' ', $line ); if( !isset( $hash[$status] ) ) { $hash[$status] = 0; } $hash[$status] += $bytes; } print_r($hash); Awk one liner compared to PHP: credits to @RichardJ #pfz channel Not a whole lot different, but already more complex and this was just a simple example... $ awk -F\ '{ totals[$9] += $10; } END { for (i in totals) { printf "%d : %d bytes\n", i, totals[i]; } }' apache.log woensdag 25 april 12