in reply to Gentleman, I'm lost.
while(<DATA>){ chomp; # remove newlines next unless $_; # no empty lines? # check if a newline is required s/(\d+:\d+)/\n${1}/; # make lines end in space (separate words) s/\s?$/ /; print; } print "\n"; # end __DATA__ 3:3 And he shall offer of the sacrifice of the peace offering an offering made by fire unto the LORD; the fat that covereth the inwards, and all the fat that is upon the inwards, 3:4 And the two kidneys, and the fat that is on them, which is by the flanks, and the caul above the liver, with the kidneys, it shall he take away. 3:5 And Aaron's sons shall burn it on the altar upon the burnt sacrifice, which is upon the wood that is on the fire: it is an offering made by fire, of a sweet savour unto the LORD.
Yields:
3:3 And he shall offer of the sacrifice of the peace offering an offer +ing made by fire unto the LORD; the fat that covereth the inwards, an +d all the fat that is upon the inwards, 3:4 And the two kidneys, and the fat that is on them, which is by the +flanks, and the caul above the liver, with the kidneys, it shall he t +ake away. 3:5 And Aaron's sons shall burn it on the altar upon the burnt sacrifi +ce, which is upon the wood that is on the fire: it is an offering mad +e by fire, of a sweet savour unto the LORD.
I still need an example of a separate chapter, or are you doing each book separately?
Here is the oneliner:
cat chapter.txt | perl -pe 'chomp; next unless $_; s/(\d+:\d+)/\n${1}/ +;s/\s?$/ /;'
Note: if you are using Windows, replace the single quotes to double quotes, i.e. perl.exe -pe "..."
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Gentleman, I'm lost.
by FreeBeerReekingMonk (Deacon) on Nov 26, 2016 at 10:43 UTC |