deleting some empty lines with sed
Peter Andersen
datpete at daimi.aau.dk
Sun Apr 28 00:35:19 AEST 1991
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.
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.
Peter
More information about the Comp.unix.shell
mailing list