in reply to Re^2: how to convert new line to ","
in thread how to convert new line to ","

Did you actually test that?

When I tried it did replace newlines with commas, but also the double newlines that bh_perl doesn't want to have replaced.

Replies are listed 'Best First'.
Re^4: how to convert new line to ","
by massa (Hermit) on Jul 25, 2008 at 09:37 UTC
    The working line would be
    perl -00pe 'chomp; s/\n/,/g; s/$/\n/' data.txt
    and, yes, I tested it :-) the chomp yanks the last \n\n, so you must put one again at the end b4 printing.
    []s, HTH, Massa (κς,πμ,πλ)
      We can get around chomping with the "-l" argument.