hi,
this is mine (a bit more obvious) solution:
#!/usr/bin/perl -p
$_='' if !/\S/ && $e; # i.e. don't print if empty and last one was empty
$e = !/\S/; # remember if last one is empty...
#eof
:)
P! Vladi.
On Mon, 12 Aug 2002 13:28:19 -0400
"Selector, Lev Y" <Lev.Selector@xxxxxx> wrote:
> Folks,
>
> I have a long file which has many "empty" lines
> with nothing but may be spaces or tabs (/^\s*$/).
>
> These lines tend to group together creating chunks
> of empty vertical space on the printout.
>
> I want to reduce the number of empty lines
> in such chunks to 1 line.
>
> What would be an elegant way to do this?
>
> Warmest Regards,
> Lev Selector
>
--
Vladi Belperchinov-Shabanski <cade@xxxxxxxxxx> <cade@xxxxxxxxxx> <cade@xxxxxx>
http://www.biscom.net/~cade http://cade.webbg.com
Now, sure as the sun will cross the sky, This lie is over
Lost, like the tears that used to tide me over...
|
Try Searching:
servers, voip, java, networking, microsoft ...
|
|
|
|