##
#!/usr/bin/perl
use strict;
use warnings;
while () {
chomp;
next unless -f();
my $text = do {
if ( open( my $fh, $_ )) {
local $/;
<$fh>;
}
else {
warn "Unable to read $_\n";
}
};
if ( $text =~ /\s(recommend\S*\s+to\s+vote\s+\S+)/ ) {
( my $hit = $1 ) =~ s/\s+/ /g;
print "$_: $hit\n";
}
else {
print "$_: NO_MATCH\n";
}
}
## ##
find * -type f | search_script.pl > hit_list.txt 2> search.errlog