Hi Kevin,
Still the code doesn't working, pls have a look at the complete code.
I've commented my original code.
#!/usr/bin/perl
use File::Find;
use strict;
my $directory = "/export/home/glk/FILES";
my $out_filename = "/export/home/glk/output_file.txt";
find (\&process, $directory);
sub process
{
# my @outLines; #Data we are going to output
my $line; #Data we are reading line by line
# Only parse files that end in .html
if ( $File::Find::name =~ /\ErrorTrades.info$/ ) {
open (FILE, $File::Find::name ) or die "Cannot open file: $!";
open( OUTFILE, "> " . $out_filename ) or die "Cannot open file: $!";
# while ( $line = <FILE> ) {
# if ($line =~ m/^Check the EMPLOYEE (.+?)/){
# push(@outLines, $line);
# }
# }
if (/^Check the EMPLOYEE(.+?) field/) {
print "$1\n";
}
# print ( OUTFILE @outLines );
close FILE;
close ( OUTFILE );
# undef ( @outLines );
}
}
I am crossing my fingers