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;
In reply to Re: Simple Parsing Script
by 2teez
in thread Simple Parsing Script
by swilhelm73
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |