in reply to Simple Parsing Script

Going through your log file with a simple while loop could do this, where any match is attached to a string variable. Check the code below

#!/usr/bin/perl use warnings; use strict; my $msg = ""; my $log_file = "Output.txt"; open my $fh, '<', $log_file or die "can't open file: $!"; while ( my $line = <$fh> ) { chomp $line; if ( $line =~ /^\bstart.+?/i ) { $msg .= $line. ' '; } elsif ( $line =~ /^\bresponse.+?$/i ) { $msg .= $line. $/; } else { next; } } close $fh or die "can't close file:$!"; print $msg;

Replies are listed 'Best First'.
Re^2: Simple Parsing Script
by swilhelm73 (Initiate) on Apr 23, 2012 at 20:16 UTC
    Tweaking the response search term (there is another line with response in it) does the trick. THANK YOU!