I have a file of several sections, each section start with specific title but all of them ending with the same string, I want to sort the file sections according to the titles without sorting the content of each section (i.e. take the whole section as one block) there is also a blank line between each two section, to clarify the idea if the input is as
string5
z
y
x
string
string2
x
z
y
f
string
the desired output would be as
string2
x
z
y
f
string
string5
z
y
x
string
string,string2andstring5, and may they occur as part of thex,z, etc.? Are any of the lines within a section empty? Are you sorting on the2and5instring2andstring5, or on the whole string?