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
In reply to Re^3: replace \n with space to join indented lines
by ikegami
in thread replace \n with space to join indented lines
by olivier
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |