Steven's Dev Blog
Tips to remind for the FUTURE.
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 - - -
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment