in reply to Re^3: duplicating the rows and joining three lines into one using perl script
in thread duplicating the rows and joining three lines into one using perl script

Yes, it is a very simple problem, indeed, with a straight forward solution.

Perhaps just a minor point: a comma probably needs to be added between the RS-RAD and RAD-RC concatenated lines.

  • Comment on Re^4: duplicating the rows and joining three lines into one using perl script

Replies are listed 'Best First'.
Re^5: duplicating the rows and joining three lines into one using perl script
by graff (Chancellor) on Oct 08, 2015 at 00:43 UTC
    I was taking for granted, based on the OP examples, that the input would always be one RS line followed by one RAd line followed by one ore more RC lines. If that's true, then "$line_out" always starts fresh on each RS line, and accumulates content until the first RC line, at which point the current RC line is only appended in the print statement, and not permanently appended to $line_out.
      Yes, and that's also how I understood it. My only point was only about adding a comma to separate the line fragments, but I had overlooked that you're actually adding the comma it in the:
      s/\s+$/,/;
      code lines.

      Sorry about the useless comment.