Mailing List Archive

Support open source code!


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: sed/vi how to concatenate all non-empty lines?



> So how to I get sed or vi to concatenate all lines within a paragraph into
> one linebut keep the empty lines between paragraphes? (i.e. concatenate
> all consecutive non-empty lines together)?

No promises, but I think this should do it for vi:

     :g/^$/.+1;/^$/-1jo

Of course, I didn't expect this to put a certain particular vi-clone into an
infinite loop either.  I'm not sure if a small test just needs gobs of CPU
time or if it really is in an infinite loop.  Sigh.

-- Norman Diamond

Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links