Path: utzoo!utgpu!water!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!bloom-beacon!bu-cs!purdue!decwrl!sun!pitstop!sundc!seismo!uunet!mcvax!hp4nl!botter!star.cs.vu.nl!maart From: maart@cs.vu.nl (Maarten Litmaath) Newsgroups: comp.unix.questions Subject: Re: sed script to combine blank lines? Keywords: sed Message-ID: <1520@piraat.cs.vu.nl> Date: 13 Oct 88 22:16:51 GMT References: <192@vlsi.ll.mit.edu> Reply-To: maart@cs.vu.nl (Maarten Litmaath) Distribution: comp Organization: VU Informatica, Amsterdam Lines: 18 In article <192@vlsi.ll.mit.edu> young@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. How about `awk'? % cat /usr/local/bin/deblank #! /bin/sh exec awk '$0 !~ /^[ \t\f]*$/ { print; prev = 0; next } { if (prev) next } { prev = 1; print "" } ' % -- Hippic sport: |Maarten Litmaath @ Free U Amsterdam: a contradiction in terms.|maart@cs.vu.nl, mcvax!botter!maart