sed script to combine blank lines?

Rahul Dhesi dhesi at bsu-cs.UUCP
Thu Oct 13 09:34:21 AEST 1988


In article <192 at vlsi.ll.mit.edu> young at vlsi.ll.mit.edu (George Young) writes:
>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.

Under 4.3BSD, "cat -s" does this, except that I don't know if it also
considers ^L to be a blank line.

Also, for screen displays only, "less" has an option to do the same.

I've never been able to make sed work with patterns that span
newlines.
-- 
Rahul Dhesi         UUCP:  <backbones>!{iuvax,pur-ee}!bsu-cs!dhesi



More information about the Comp.unix.questions mailing list