Loading ...
Sorry, an error occurred while loading the content.

Two lines in one match

Expand Messages
  • Douglas Wade
    I have looked at this long enough. Help! I just don t get it. I would like to do a conditional check to see if a exists between a and a .
    Message 1 of 1 , Mar 1, 2001
    • 0 Attachment
      I have looked at this long enough. Help! I just don't get it.

      I would like to do a conditional check to see if a <t=,2> exists
      between a <t+,1> and a <t=,3>. If not, create the <t=,2>.

      This is what I have, that does not work:

      $/ = ".\n";
      while (<>) {
      if ( /<t\+,1>(.*)\n<t=,3>/ ) {
      s/(<t+,1>.*)/$1\n<t=,2>/ig ;
      }
      print;
      }

      Source File :
      <t+,1> - - - -
      <t=,3>AIR REGULATOR CONTROLLERS
      <t=,4>41M00
      <t+,1>
      <t=,3>NOC
      <t=,4>41M99

      Desired Output:
      <t+,1> - - - -
      <t=,2>
      <t=,3>AIR REGULATOR CONTROLLERS
      <t=,4>41M00
      <t+,1>
      <t=,2>
      <t=,3>NOC
      <t=,4>41M99
    Your message has been successfully submitted and would be delivered to recipients shortly.