in reply to Re: Merge pairs of lines
in thread Merge pairs of lines

My attempt,

perl -pe '$_=/\S/?do{chop;$_.",".<>}:""'
assumes non-blank lines come in pairs.

Yours doesn't look right to me though...

286,0 sauoq@grover:~$ perl -l054p012e'($\,$a)=($a||$\,$b||$/);$b=$\' < + test.txt a,b ,c d,287,0 sauoq@grover:~$ cat test.txt a b c d 288,0 sauoq@grover:~$
-sauoq
"My two cents aren't worth a dime.";

Replies are listed 'Best First'.
Re^3: Merge pairs of lines
by Aristotle (Chancellor) on Jan 31, 2003 at 06:00 UTC
    It ignores the issues of blank lines, if you mean that, but so does the OP's code because next doesn't work the way he thinks. (The print is in a continue block so it always gets executed short of dieing.) I chose to note and ignore it. What I was trying to do is achieve the described behaviour without explicitly manipulating $_ or printing anything myself.

    Makeshifts last the longest.