sed script to combine blank lines?
Alan Ramacher
rar at nascom.UUCP
Fri Oct 14 01:36:16 AEST 1988
In article <192 at vlsi.ll.mit.edu>, young at vlsi.ll.mit.edu (George Young) writes:
> Is there a 'sed' wizard out there? I often want to take a big ascii file
> (like a .c file after cc -E) and collapse each group of 'blank' lines
> into exactly one blank line. 'Blank' here is any combination of blanks,
> tabs and maybe ^L's. It looks from the documentation that sed should do this
> quite neatly, using the multiple line pattern space commands with imbedded
> newlines, but I sure can't figure out how. I'd prefer the resulting blank
> line to be just a newline.
sed is not powerful enuf for the job, but a simple awk script will
work. If you have difficulties writting it, let me know and I will
supply one. Good luck.
Allan Ramacher
More information about the Comp.unix.questions
mailing list