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";

In reply to Re^2: How can I find a line in a RTF file? by kevyt
in thread How can I find a line in a RTF file? by kevyt

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.