Thursday, August 7, 2014

Join odd and even numbered lines

sed:

sed '$!N;s/\n/,/'


awk:

awk 'NR%2==0 {print p","$0;} NR%2 {p=$0;}'


paste:

paste - -


--------------------------
Seems  I like paste most. To join 3 consecutive lines:

paste - - -