in reply to Re: replace \n with space to join indented lines
in thread replace \n with space to join indented lines

Thank you ikegami. The problem is that I do have files that have paragraphs that contain more than 2 lines (sorry, I should have made that clearer in my original post). Is there a way in which you solution could be invoked as a one liner? Thank you
  • Comment on Re^2: replace \n with space to join indented lines

Replies are listed 'Best First'.
Re^3: replace \n with space to join indented lines
by ikegami (Patriarch) on Dec 05, 2006 at 16:10 UTC

    If you want a one-liner, put it all on one line!

    perl -i.bak -e "local $/; $_=<>; 1 while s/^(([ ]+)(?![ ])[^\n]+)\n\2( +?![ ])/$1/m; print" myfile.txt