in reply to Re^2: replace \n with space to join indented lines
in thread replace \n with space to join indented lines
Setup a while loop that automatically prints the current line and with the -l switch chomps the input and appends the output record separator.perl -lpe'
Change the input record separator to a newline followed by four spaces.BEGIN { $/ = "\n " }
With the chomped line (after the input record separator has been removed), count the number of newlines. If there are no newlines then set the output record separator to the list separator (a single space), otherwise set the output record separator to the input record separator.$\ = y/\n// ? $/ : $"'
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: replace \n with space to join indented lines
by olivier (Initiate) on Dec 06, 2006 at 16:39 UTC |