Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!wuarchive!udel!haven.umd.edu!umbc3.umbc.edu!math16.math.umbc.edu!rouben From: rouben@math16.math.umbc.edu (Rouben Rostamian) Newsgroups: comp.unix.shell Subject: Re: deleting some empty lines with sed Message-ID: <1991Apr27.193342.6125@umbc3.umbc.edu> Date: 27 Apr 91 19:33:42 GMT References: <1991Apr27.143519.26256@daimi.aau.dk> Sender: newspost@umbc3.umbc.edu (News posting account) Organization: University of Maryland Baltimore County, Mathmatics Department Lines: 30 In article <1991Apr27.143519.26256@daimi.aau.dk> datpete@daimi.aau.dk (Peter Andersen) writes: >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. This should do it: sed -n -e ' /^ *$/!p /^ *$/{ p :loop n /^ *$/bloop p }'