From owner-freebsd-questions@FreeBSD.ORG Tue Nov 24 01:39:40 2009 Return-Path: Delivered-To: freebsd-questions@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0686F106566B for ; Tue, 24 Nov 2009 01:39:40 +0000 (UTC) (envelope-from kline@thought.org) Received: from aristotle.thought.org (ns1.thought.org [209.180.213.210]) by mx1.freebsd.org (Postfix) with ESMTP id B7E7F8FC08 for ; Tue, 24 Nov 2009 01:39:39 +0000 (UTC) Received: from thought.org (tao.thought.org [10.47.0.250]) (authenticated bits=0) by aristotle.thought.org (8.14.2/8.14.2) with ESMTP id nAO1dHJU010559; Mon, 23 Nov 2009 17:39:17 -0800 (PST) (envelope-from kline@thought.org) Received: by thought.org (nbSMTP-1.00) for uid 1002 kline@thought.org; Mon, 23 Nov 2009 17:39:35 -0800 (PST) Date: Mon, 23 Nov 2009 17:39:35 -0800 From: Gary Kline To: Chris Cowart Message-ID: <20091124013934.GA51279@thought.org> References: <20091124002920.GA51110@thought.org> <20091124003652.GH11723@hal.rescomp.berkeley.edu> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20091124003652.GH11723@hal.rescomp.berkeley.edu> User-Agent: Mutt/1.4.2.3i X-Organization: Thought Unlimited. Public service Unix since 1986. X-Of_Interest: With 23 years of service to the Unix community. X-Spam-Status: No, score=-4.4 required=3.6 tests=ALL_TRUSTED,BAYES_00 autolearn=ham version=3.2.3 X-Spam-Checker-Version: SpamAssassin 3.2.3 (2007-08-08) on aristotle.thought.org Cc: FreeBSD Mailing List Subject: Re: need a newline between paragraphs.... X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Nov 2009 01:39:40 -0000 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 "^$" <> 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