#!/usr/bin/perl -w # Version 0.2 ######################################## # Modules use strict; # parameter Definition before use them ####################################### # Paramet Definition my $ct=1; # counter parameter my $lines; #my $target ="./TestFile.log"; #my $file2 ="./SpyLogs.log"; my ($file1,$file2,$NoString,$Strg); my $BString ="Start"; my $EString ="End"; my @data =(""); ########################### # main programm system("clear"); ########################### print "Which File: "; $file1=; chomp $file1; print "File-Name for Result: "; $file2=; chomp $file2; print "Call-Number: "; $Strg=; chomp $Strg; $NoString ="Number=$Strg"; #print $NoString; open(InFile,"<",$file1) or die $!; # Get the file to the Script Input open(OutFile,">",$file2) or die $!; # Get the file to the Script Output while ($lines = ) { if ( $lines =~ m{$BString} .. $lines =~ m{$EString} ) { if ($lines =~ m{$NoString}){ push(@data,$lines);} # tu was mit Zeilen von START bis ENDE (Regex Matching) } } print OutFile @data; # Store information to File close(InFile);close(OutFile); # close the files