1. vi: convert double blank lines to single blank lines???
sed "/./,/^$/!d" file
or, more generally
sed "/./,/^ *$/!d" file
( copyright Brian Hiles, or is it Greg Uben ? )
JOIN SEDERS MAILING LIST
DISCUSS SED WITH US
: > I receive some files which contain, among other amusements, 2 (or more)
: > consecutive blank lines. I wish to compress every occurrence of multiple
: > blank lines to one blank line. I have already suppressed leading (and,
: > for that matter, trailing) white space, so all the lines actually match
: > /^$/ if that helps.
: > Personally, I think it is not possible, but there are many of you out
: > there with even more perverse minds than mine. Thanks for looking at my
: > problem. Responses either here to the newsgroup, or, if you think this
: > too esoteric for general interest, to my E-mail address below.
: Not sure if this is supposed be done in vi. I think it should, and Sven
: has shown how to do this. Otherwise, you could use:
: :%!cat -r
: Purely for esoteric interest :-> I include this sed script:
: #!/usr/bin/sed -f
: # on empty lines, join with next
: # now, squeeze all newlines
: Casper Boden-Cummins.
al aab, seders moderator sed u soon
it is not zat we do not see the s o l u t i o n
2. Installing 2 NE2000 compatible network cards
3. OT: oh...oh...Microsoft's growth SLOWS (.NET as salvation?)
4. inserting a blank line after every line - using sed
5. Realtime threads...
6. insert a blank line to divide blocks of lines
7. How do you connect to the internet with REDHAT 5.2
8. Vi command to insert at the begin of a line for lines in a file
9. multiple blank lines -> one blank line
10. inserting blank lines
11. Insert a line of text every nth line
12. How do I insert line numbers before each line using ed?