Sort text by Chapter namesby Bman70 (Acolyte)
|on May 24, 2018 at 05:24 UTC||Need Help??|
Bman70 has asked for the wisdom of the Perl Monks concerning the following question:
Is there any way to take a block of text that includes different Chapter names, and then sort all of the text so that the Chapter names are in alphabetic order, while keeping the correct text with each Chapter?
Example of the text I'm trying to sort:
What I would want is to sort these chapters to be in Alphabetical order.. they don't need to be in order numerically. I just want to know if there's a sort function that can arrange each title in order while preserving the text associated with each title. Resulting in something like:
The text is all in a text file. There are some newlines and a mix of letters and numbers.
Thank you for any tips you can offer.