deleting some empty lines with sed

Dave Hammond daveh at marob.uucp
Wed May 1 04:14:50 AEST 1991


In article <1991Apr27.143519.26256 at daimi.aau.dk> datpete at daimi.aau.dk (Peter Andersen) writes:
>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.
>[sed example deleted]
>Does anyone have a way of doing this, perhaps using something
>else but sed. I'm not a perl-guru, but if its possible in perl
>I'd like to hear about that too.

Perhaps I'm oversimplifying the problem, but wouldn't

tr -s '\012'

squeeze multiple, consecutive newlines to a single newline?

--
Dave Hammond
daveh at marob.uucp
uunet!rutgers!phri!marob!daveh



More information about the Comp.unix.shell mailing list