need a newline between paragraphs....

Gary Kline kline at
Tue Nov 24 01:39:40 UTC 2009

On Mon, Nov 23, 2009 at 04:36:52PM -0800, Chris Cowart wrote:
> Gary Kline wrote:
> > 	some several weeks ago, i got the appended perl code sent that
> > 	takes a very long txt file and diving by ``Chapter NN'' puts
> > 	the long file into seperate files, 01 to 66.  trouble is that
> > 	it is hard to read by eyes without a space between paragraphs.
> > 
> > 	it's easy for grep to remove all newlines.  How do i add them
> > 	back?
> [...]
> > # We've read at least one chapter heading.
> > while (<>) {
> >     chomp;
> >     $fh = newchapter($1) if /$regex/;
	    next if /^#/;
> It looks like this line of code is killing the blank lines. If you
> delete the line and re-run the program, you should be good to go. If you
> don't have the original anymore, it'll be a lot harder and much less
> accurate.
> Good luck,

	thanks;  you were right on the money. 

	i think that by doing a

	grep -v "^$" <<file[s]>>

	all blank lines are scotched.  in this perl script, the syntax
	didn't catch my eye.   at least that's my excuse... .

	anyway, axeing that line did the trick; now i can chapterize
	my book from the huge text file.


	PS: is there any one-liner to add back one newline between


> -- 
> Chris Cowart
> Network Technical Lead
> Network & Infrastructure Services, RSSP-IT
> UC Berkeley

 Gary Kline  kline at  Public Service Unix
    The 7.31a release of Jottings:

More information about the freebsd-questions mailing list