Thanks. I almost have this working. I dont know how the index works in the code above. I need to do more searching for @- and @+.
I'm scanning the documents on a windows OS because the dates will change if I transfer to linux. the documents might also have several pages of text between the "Date of Last Update" and signatures. I'm on a team of a few people trying to determine why policies take so long to get signed. I have not used perl extensively for several years. Thanks for your help. I'll update the page with the code and 2 sample files when I am done.
#!/usr/bin/perl
use Modern::Perl;
use RTF::TEXT::Converter;
my $string;
my $object = RTF::TEXT::Converter->new(output => \$string);
$object->parse_stream( '..\Policies\Test\000144027.rtf' );
chomp $string;
my @string = split("\n", $string);
my $number_of_sigs = 0;
foreach my $line (@string) {
chomp $line;
if ($line =~ m/Date of Last Update:(.*)/){
my $date_of_last_update = $1;
$date_of_last_update =~ s/^\s+//;
print "Date of last update is: $date_of_last_update\n";
}
if ($line =~ m/Document #:(.*)/){
print "\nDocument number is $1\n";
}
# Sign-Off Approvals
if ($line =~/'Sign-Off Approvals'/){
print $line;
$number_of_sigs ++;
}
# next;
#next if $line !~ /\w+/;
#next if $line =~ /^\_+\/\_+\/\_+$/;
#say $line;
}
print "number of signatures is $number_of_sigs \n";