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

Re: [MacPerl] Would like suggestion.



On Mon, Dec 04, 2000 at 07:10:55PM +0000, Bill Becker wrote:
> Greetings!
> 
> I have a very large text file with about 90,000 lines in it. A vast
> majority of the lines are blank. (In case anyone is interested, it was
> created with the bookmanager print-to-file command)
> 
> My question involves is this: When 3 (or "N") or more blank lines are
> found, delete them. Leaving 2 in their place, and possibly a marker.
> 
> Is this easy in PERL? (I know everthing in PERL is easy to a lot of you
> folks, it's just not intuitively obvious to me, yet!)

Here's an approach that takes advantage of paragraph mode:

#!perl -p00

__END__

That only works when N = 3, though.

Enjoy!
Ronald

# ===== Want to unsubscribe from this list?
# ===== Send mail with body "unsubscribe" to macperl-request@macperl.org