[Gllug] sed script for removing lone new line characters

Tethys sta296 at astradyne.co.uk
Mon Mar 6 08:47:54 UTC 2006


"Dan Stevens (IAmAI)" writes:

>Perhaps I give my own example of what I have now, and how I would like
>it after processing.
>
>$ cat before
>I would like this line
>and this line, on one line.
>
>But I would like a blank line between this paragraph and the previous.
>
>$ cat after
>I would like this line and this line, on one line.
>
>But I would like a blank line between this paragraph and the previous.

Here you go then:

	:start
	/\n$/!{
		N
		b start
	}
	$!a\

	s/\(.\)\n/\1 /g

Tet
-- 
Gllug mailing list  -  Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug




More information about the GLLUG mailing list