in reply to Re^2: Join lines that match an string
in thread Join lines that match an string

Right, unlike the other solutions, that one joins the line with the terminator and the next one. You could write

perl -wpe 'if ((/\bremotely\b/.../\bp_args\b/) !~ /^$|E0/) { chomp }' +a
but that's a bit ugly, or decide that the flip-flop shortcut isn't appropriate in such case and track the flag by hand, such as
perl -wpe 'if (($_f ||= /\bremotely\b/) &&= !/\bp_args\b/) { chomp }' +a

Replies are listed 'Best First'.
Re^4: Join lines that match an string
by ranrodrig (Novice) on Jul 13, 2010 at 20:00 UTC

    Linuxer your code is great as Ambrus one and yours keep the last line where it shoudl be, just to end this, how could I insert a blank where there was a line feed (\n)? because in some cases I need to separate the info and in others no

    Again thanks for your help

      Read Re: Join lines that match an string again, for it has two examples that both don't join the line after the p_args line, and do add a space if there'd be none where the lines are joined.