Merge lines with SED.


/ Published in: Bash
Save to your folder(s)

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/


Copy this code and paste it in your HTML
  1. sed '$!N;s/\n/ /'

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.