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
pgp51hzqyX77C.pgp
Description: PGP signature