Hello HDTVJohn, and welcome to the Monastery!

Here’s my take on your problem, a variation on GrandFather’s solution:

#! perl use strict; use warnings; use utf8; while (<DATA>) { chomp; my ($timecode, $text) = m!^\\ TC: (\d{2}:\d{2}:\d{2};\d{2}) (.*)$ +! or die "Unexpected line: '$_'"; if ($text =~ m!÷\w{4}!) { $text =~ s!^(?:÷\w{4})+(.*?)$!$1!; print "\n\\ TC: $timecode $text"; } else { print $text; } } print "\n"; __DATA__ \ TC: 16:12:48;28 ÷1426÷1426÷142D÷142D÷1470÷1470AND W \ TC: 16:12:49;08 HI \ TC: 16:12:49;11 LE \ TC: 16:12:49;14 OVER \ TC: 16:12:49;19 T \ TC: 16:12:49;21 HE L \ TC: 16:12:49;24 AS \ TC: 16:12:49;27 T 10 \ TC: 16:12:50;07 ÷1426÷1426÷142D÷142D÷1470÷1470YEARS \ TC: 16:12:50;17 W \ TC: 16:12:50;19 E' \ TC: 16:12:50;21 VE M \ TC: 16:12:50;25 AD \ TC: 16:12:50;27 E \ TC: 16:12:51;09 MAJ \ TC: 16:12:51;13 OR \ TC: 16:12:52;22 ÷1426÷1426÷142D÷142D÷1470÷1470INVESTMENTS

Output:

14:49 >perl 945_SoPW.pl \ TC: 16:12:48;28 AND WHILE OVER THE LAST 10 \ TC: 16:12:50;07 YEARS WE'VE MADE MAJOR \ TC: 16:12:52;22 INVESTMENTS 14:49 >

Hope that helps,

Athanasius <°(((><contra mundum Iustus alius egestas vitae, eros Piratica,


In reply to Re: Search/format Across Multiple Lines by Athanasius
in thread Search/format Across Multiple Lines by HDTVJohn

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.