Newsgroups: comp.unix.shell Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!uupsi!cmcl2!phri!marob!daveh From: daveh@marob.uucp (Dave Hammond) Subject: Re: deleting some empty lines with sed Organization: ESCC, New York City Date: Tue, 30 Apr 91 18:14:50 GMT Message-ID: <281DB41B.9E6@marob.uucp> Summary: use tr -s '\012' References: <1991Apr27.143519.26256@daimi.aau.dk> Lines: 22 In article <1991Apr27.143519.26256@daimi.aau.dk> datpete@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@marob.uucp uunet!rutgers!phri!marob!daveh