Note: the complementary question is here: How to separately sort lines within multiple “chunks” separated with headers?
So what I did find an answer to, is how to sort lines in a text files alphabetically. But, it is not exactly what I need to do. I have this file with profiles containing 15 different parameters that goes into an instrument at work and is read by the machine to have a list of profiles.
Sadly, the formatting of this file looks like this:
[ProfileB] param1=z param2=y param3=x [ProfileA] param1=k param2=l param3=
And I want to sort the Profiles alphabetically, but I need them to stay grouped with their parameters. The above example should be sorted like this:
[ProfileA] param1=k param2=l param3= [ProfileB] param1=z param2=y param3=x
I guess there is something to work either with the fixed number of lines (name+parameters) or with the character "[" as an identifier for the beginning of a group of lines.
But this is beyond my capacity in text manipulation. I have at my disposition either Sublime Text, R, or Linux command console.