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. RAM interleaving with performance?
3. multiple blank lines -> one blank line
4. Useradministration on Apache/PHP/MySQL
5. vi: convert double blank lines to single blank lines???
6. ipchains -- support for DHCP?
7. Find a string, delete that line, delete 1 line before it and all lines after it...
8. GCC 2.7.2 (internal err 11), help...
9. adding new line to external text file below a line that contains <string>
10. Vi -- How to Insert a Blank Line to all existing lines
11. inserting a blank line after every line - using sed
12. line number of the first blank line?
13. Remove a line if next line is blank