Posted By

bubnoff on 05/11/11


Tagged

sed


Versions (?)

Merge lines with SED.


 / Published in: Bash
 

Merge line below to current line.

"This one-liner joins two consecutive lines with the "N" command. They get joined with a "\n" character between them. The substitute command replaces this newline with a space, thus joining every pair of lines with a whitespace."

From catonmat here:

http://www.catonmat.net/blog/sed-one-liners-explained-part-one/

  1. sed '$!N;s/\n/ /'

Report this snippet  

You need to login to post a comment.