Sed replace newline character

Categories: Uncategorized
2 Responses

Since sed parses data line per line normally you need to get the next line in the buffer also, you can do this like this:
cat textfile | sed ‘/.*$/N;s/\n */ /’
the clue here is the /N will put the next line in the buffer.

2 Comments to “Sed replace newline character”  

  1. cat abuse! Better use:

    <textfile sed ‘/.*$/N;s/\n */ /’

  2. 2
  3. Ghosty Says:

    ok but in my case it was output of a tool i needed (did not use it like this in the real world 🙂 )

Leave a Reply