in reply to Buffered read and matching
Also worth investigating is sliding window technique, ex Matching in huge files#!/usr/bin/perl -- use strict; use warnings; my $line = ""; OUTER: while (<DATA>) { if (/^\[/) { # could use \[\d{4} $line = $_; } INNER: my $i = 0; while (<DATA>) { if (/^\[/) { print $line, "\n" if $i; $line = $_; next OUTER; } $line .= $_; $i++; } } __DATA__ [2008/10/14 10:57:18] [55] DEBUG Austin::API::vendor_api - Initialisin +g the API Galileo [2008/10/14 10:57:18] [55] DEBUG Austin::API::vendor_api - Initialisin +g the API Galileo [2008/10/14 10:57:18] [55] DEBUG Austin::API::vendor_api - Initialisin +g the API Galileo [2008/10/14 10:57:18] [41] DEBUG Austin::Suppliers::Common::Location:: +init - Setting Up Generic Locations [2008/10/14 11:15:22] [147] DEBUG Austin::Controller::default - $VAR1 += { 'Errors' => [ { 'ID' => 'noRates', 'Error' => 'No Rates for given dates/times', 'object' => '/var/website/modules/Austin/CB/ +Search.pm', 'Location' => undef, 'line' => 371 }, ] }; [2008/10/14 10:57:18] [245] DEBUG Austin::XV::Trip::set_time_zone - Ch +ecking timezone with agent UK [2008/10/14 10:57:18] [247] DEBUG Austin::XV::Trip::set_time_zone - Se +tting timezone to Europe/London [2008/10/14 11:15:22] [2008/10/14 11:15:22] [147] DEBUG Austin::Controller::default - $VAR1 += { 'Errors' => [ { 'ID' => 'noRates', 'Error' => 'No Rates for given dates/times', 'object' => '/var/website/modules/Austin/CB/ +Search.pm', 'Location' => undef, 'line' => 371 }, ] }; [2008/10/14 11:15:22]
|
|---|