gsed ":a;N;s/\n/,/g;ta"
Or
gsed ":d;N;s/\n/,/g;td"
It means it will jump to the tag :a or :d, if one time failed, then it will break.
gsed ":a;N;s/\n/,/g;ba"
Or
gsed ":d;N;s/\n/,/g;bd"
Refer
sed '/^$/{N;/^\n$/D}'
E.g. Remove all the redundant empty lines in the Java source code
find app/src/ -iname "*.java" -exec gsed -i '/^$/{N;/^\n$/D}' {} +
sed 'N;N;s/\n/ /g'
cat crashlist_googleplay_20181012.txt|grep -v "^$"|grep -A 2 "^in"|grep -v "-"|gsed "N;N;s/\n/ /g"|awk '{sum += $4 } END { print sum }'