perl -pe 'next unless /\S/; s/\n/,/ if ($a = 1 - $a)'