Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!mips!news.cs.indiana.edu!rutgers!rochester!kodak!ispd-newsserver!garden.ssd.kodak.com!weimer From: weimer@garden.ssd.kodak.com (Gary Weimer (253-7796)) Newsgroups: comp.unix.shell Subject: Re: deleting some empty lines with sed Message-ID: <1991Apr29.150244.4378@ssd.kodak.com> Date: 29 Apr 91 15:02:44 GMT References: <1991Apr27.143519.26256@daimi.aau.dk> <1991Apr27.211212.18855@convex.com> Sender: news@ssd.kodak.com Reply-To: weimer@ssd.kodak.com Organization: Eastman Kodak Co.; Rochester, NY Lines: 28 In article <1991Apr27.211212.18855@convex.com>, Tom Christiansen writes: |> From the keyboard of datpete@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@ssd.kodak.com ( Gary Weimer )