deleting some empty lines with sed

Gary Weimer 253-7796 weimer at garden.ssd.kodak.com
Tue Apr 30 01:02:44 AEST 1991


In article <1991Apr27.211212.18855 at convex.com>, Tom Christiansen
<tchrist at convex.COM> writes:
|> From the keyboard of datpete at daimi.aau.dk (Peter Andersen):
|> :I have some source-files that I produce documentation from.
|> :
|> :I use sed to make a few changes to the text. I have figured
|> :most of it out, but I have one problem remaining:
|> :If two or more blank lines appear, I want to remove all but
|> :one of these.
|> :
|> :I have tried the following sed script
|> :
|> :    s^ *$//p
|> :1,$ N
|> :    s/\(\n\n\)\n*/\1/gp
|> :
|> :but it didn't work.
|> 
|> You need to set up a look with labels and branches.  I see that as I type
|> this another poster has given you a sed solution, so I won't post my
|> crufty version of the same.

[three perl scripts deleted]

Wouldn't 'cat -s' be easier? I know, it's not near as exciting, but...

weimer at ssd.kodak.com ( Gary Weimer )



More information about the Comp.unix.shell mailing list