paulm2 has asked for the wisdom of the Perl Monks concerning the following question:
Hi, I'm trying to insert newline paragraph breaks every 5 periods (sentences), in a text file. I'm getting a blank output, no errors. Thanks in advance.
perl -e '$count = 0; s/\./(++$count % 5 == 0)?"\n":$&/ge;' text-blob.txt > paragraphs.txt
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Newline after every 5 periods
by kcott (Archbishop) on Jul 20, 2016 at 06:19 UTC | |
by paulm2 (Initiate) on Jul 20, 2016 at 12:29 UTC | |
|
Re: Newline after every 5 periods
by Anonymous Monk on Jul 20, 2016 at 04:47 UTC | |
by paulm2 (Initiate) on Jul 20, 2016 at 12:41 UTC | |
by choroba (Cardinal) on Jul 20, 2016 at 12:50 UTC | |
by paulm2 (Initiate) on Jul 20, 2016 at 13:12 UTC | |
by AnomalousMonk (Archbishop) on Jul 20, 2016 at 14:01 UTC | |
by paulm2 (Initiate) on Jul 20, 2016 at 14:13 UTC | |
by Anonymous Monk on Jul 20, 2016 at 17:50 UTC | |
by paulm2 (Initiate) on Jul 20, 2016 at 21:21 UTC |