deleting all blank lines in a file

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

deleting all blank lines in a file

jkilbour
I wish to delete all blank lines. I tried
:global /^$/ delete
but some blanks remain, possibly with spaces or tabs. Is there a "space
class" I can use?

Thanks


Reply | Threaded
Open this post in threaded view
|

Re: deleting all blank lines in a file

Mike McNally-2
On Wed, 15 Jun 2005, [hidden email] furiously typed:

> I wish to delete all blank lines. I tried
> :global /^$/ delete
> but some blanks remain, possibly with spaces or tabs. Is there a "space
> class" I can use?

How about
 
  :g/^\s*$/d

--
[ you are my main foo ] Mike McNally -- [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: deleting all blank lines in a file

Neil Watson
In reply to this post by jkilbour
On Wed, Jun 15, 2005 at 11:27:52AM -0400, [hidden email] wrote:
>I wish to delete all blank lines. I tried
>:global /^$/ delete
>but some blanks remain, possibly with spaces or tabs. Is there a "space
>class" I can use?

:he regex

search for whitespace.

--
Neil Watson               | Gentoo Linux
Network Administrator     | Uptime 5 days
http://watson-wilson.ca   | 2.6.11.4 AMD Athlon(tm) MP 2000+ x 2