need a newline between paragraphs....

Chris Cowart ccowart at rescomp.berkeley.edu
Tue Nov 24 00:36:53 UTC 2009


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.

>     print $fh "$_";
> }

Good luck,

-- 
Chris Cowart
Network Technical Lead
Network & Infrastructure Services, RSSP-IT
UC Berkeley
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 834 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-questions/attachments/20091124/a76960fe/attachment.pgp


More information about the freebsd-questions mailing list