Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 23 Nov 2009 17:39:35 -0800
From:      Gary Kline <kline@thought.org>
To:        Chris Cowart <ccowart@rescomp.berkeley.edu>
Cc:        FreeBSD Mailing List <freebsd-questions@FreeBSD.ORG>
Subject:   Re: need a newline between paragraphs....
Message-ID:  <20091124013934.GA51279@thought.org>
In-Reply-To: <20091124003652.GH11723@hal.rescomp.berkeley.edu>
References:  <20091124002920.GA51110@thought.org> <20091124003652.GH11723@hal.rescomp.berkeley.edu>

next in thread | previous in thread | raw e-mail | index | archive | help
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.

	gary

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


	 


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



-- 
 Gary Kline  kline@thought.org  http://www.thought.org  Public Service Unix
        http://jottings.thought.org   http://transfinite.thought.org
    The 7.31a release of Jottings: http://jottings.thought.org/index.php




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20091124013934.GA51279>