Just out of curiosity: Would the RTF::TEXT::Converter module work instead? Have not used it myself, but was theorizing that it might be simpler to process plain text output from this module...?
Different approach... Just a thought...
Update:
I became curious about this so tried the following:
#!/usr/bin/perl use Modern::Perl; use RTF::TEXT::Converter; my $string; my $object = RTF::TEXT::Converter->new(output => \$string); $object->parse_stream( "/home/wjw/tmp/RTF_test.rtf" ); chomp $string; my @string = split("\n", $string); foreach my $line (@string) { chomp $line; next if $line !~ /\w+/; next if $line =~ /^\_+\/\_+\/\_+$/; say $line; }
.. which is in-complete and with a leaning toothpick eye-sore in the second regex, but gets one to the point of only having to deal with the text.
Output is as follows:
Use of uninitialized value $cstylename in string ne at /home/wjw/perl5 +/perlbrew/perls/perl-5.20.0/lib/site_perl/5.20.0/RTF/Control.pm line +1489, <GEN1> line 16. Document #: 000 Version #: 1 Document Owner: Someone Date of Last Update: 10/15/2013 Written by: Someone Status: Approved General Description Purpose Definitions Procedures Sign-Off Approvals Jane Doe, CEO Date John Doe, CFO Date
I did not dive into the warning issued. Note that the install of the referred to module actually depends on two others, one of which I think you were using already.
cpanm RTF::TEXT::Converter --> Working on RTF::TEXT::Converter Fetching http://www.cpan.org/authors/id/S/SA/SARGIE/RTF-Parser-1.12.ta +r.gz ... OK Configuring RTF-Parser-1.12 ... OK ==> Found dependencies: RTF::Tokenizer --> Working on RTF::Tokenizer Fetching http://www.cpan.org/authors/id/S/SA/SARGIE/RTF-Tokenizer-1.18 +.tar.gz ... OK Configuring RTF-Tokenizer-1.18 ... OK Building and testing RTF-Tokenizer-1.18 ... OK Successfully installed RTF-Tokenizer-1.18 Building and testing RTF-Parser-1.12 ... OK Successfully installed RTF-Parser-1.12 2 distributions installed
...the majority is always wrong, and always the last to know about it...
Insanity: Doing the same thing over and over again and expecting different results...
A solution is nothing more than a clearly stated problem...otherwise, the problem is not a problem, it is a facct
In reply to Re: How can I find a line in a RTF file?
by wjw
in thread How can I find a line in a RTF file?
by kevyt
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |