I really think we (and perhaps, you) need a clearer definition of what you're trying to do... and what rule establishes that the "requirement is met?"

If it's a one-off replacement, done once, you can do it manually -- with an editor -- far more readily than with a script, regexen and an ill-speced appear to the Monks.

So, judging that what you've shown is one sample of multiple replacements you need to do, give us the rule for replacement: what does the "following line" have to contain (and what is NOT allowed in it) to justify replacing the preceding line?

A good spec makes it easy for us to help. Posting a poor, incomplete or inaccurate spec just leads to frustration, all around.


In reply to Re: replace part of a line with part of the following line after if is TRUE by ww
in thread replace part of a line with part of the following line after if is TRUE by N311V

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.