sed script to combine blank lines?
Maarten Litmaath
maart at cs.vu.nl
Fri Oct 14 08:16:51 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.
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 at cs.vu.nl, mcvax!botter!maart
More information about the Comp.unix.questions
mailing list