->Title Page
->Vi editor
-->Vi reference
-->Miscellaneous tips
--->Line deletions
--->Switching cases
--->Spell checking
--->Advanced S and R
->Blank lines
->Mirror sites
->Further reading

[ Up ]

Vi ---> Removing blank lines

Blank lines can be removed from a file with any of the following:



    :%!cat -s
If you want to get rid of duplicate blank lines, but leave the first blank line intact, try:

    :%!sed /./,/^$/!d
Be aware that you may need to get rid of trailing whitespace first. This can be accomplished with

    :%s/[ ^I]*$/

Site Statistics

Find this site useful? Want to give something back?

t a y l o r@l i n u x a v e.n e t

© 1993-2000 Christopher C. Taylor