I have a script that is parsing through large text files
I rewrote it, assuming a text file.
#!/usr/bin/perl
use warnings;
use strict;
my $file = <<FILE;
t13:45
D13:45
S13:45 Unicorn
D13:45
S13:45
T13:45
t13:45
D13:45
T13:46
t13:45
D13:45
S13:45
D13:45
S13:45 UNICORN
T13:45
t13:45
D13:45
T13:46
FILE
my $value = 'unicorn';
open my $FH, '<', \$file or die "Cannot open 'file' because: $!";
my $section = '';
while ( <$FH> ) {
if ( /^t/ .. /^T/ ) {
$section .= $_;
}
if ( /^T/ ) {
print $section if $section =~ /$value/i;
$section = '';
}
}
Debug statements are left as an exercise for the OP.