Tim Chase wrote:
> 1. within each block, add the sort keys in front of each
> line (surname, personal name, line number), plus maybe a
> delimiter to make step 3 (below) easier.
> 2. sort
> 3. remove the sort keys added in step 1
Do I understand your suggestion is to tweak the file to look
like
==================================================
[X] 100% Soccer team
Sims, Tim@ [X] 100% Sims, Tim
Sims, Tim@ [X] 100% physical
Sims, Tim@ [X] 100% uniform deposit #31
Smith, Sam@ [ ] 50% Smith, Sam
Smith, Sam@ [ ] 0% physical
Smith, Sam@ [X] 100% uniform deposit
Comer, Hannah@ [ ] 0% Comer, Hannah
Comer, Hannah@ [ ] 0% physical
Comer, Hannah@ [ ] 0% uniform deposit #8
Thornton, Tyler@ [X] 100% Thornton, Tyler
Thornton, Tyler@ [X] 100% physical
Thornton, Tyler@ [X] 100% uniform deposit #35
==================================================
and then running running sort over the remainder?
My attempt to try your suggestion comes up with the
sub-lists being inverted and the spaces between the lines
being moved up to the top (using ":2,$!sort")
==================================================
[X] 100% Soccer team
Comer, Hannah@ [ ] 0% physical
Comer, Hannah@ [ ] 0% uniform deposit #8
Comer, Hannah@ [ ] 0% Comer, Hannah
Sims, Tim@ [X] 100% physical
Sims, Tim@ [X] 100% uniform deposit #31
Sims, Tim@ [X] 100% Sims, Tim
Smith, Sam@ [ ] 0% physical
Smith, Sam@ [X] 100% uniform deposit
Smith, Sam@ [ ] 50% Smith, Sam
Thornton, Tyler@ [X] 100% physical
Thornton, Tyler@ [X] 100% uniform deposit #35
Thornton, Tyler@ [X] 100% Thornton, Tyler
==================================================
which, after undecorating with the names, becomes:
==================================================
[X] 100% Soccer team
[ ] 0% physical
[ ] 0% uniform deposit #8
[ ] 0% Comer, Hannah
[X] 100% physical
[X] 100% uniform deposit #31
[X] 100% Sims, Tim
[ ] 0% physical
[X] 100% uniform deposit
[ ] 50% Smith, Sam
[X] 100% physical
[X] 100% uniform deposit #35
[X] 100% Thornton, Tyler
==================================================
which isn't quite what I understood the OP wanted. :)
though, as always, the error my lay in my understanding of
your solution, rather than in the solution itself...
-tim
What I meant is:
[EMAIL PROTECTED] 100% Soccer Team
002@
Sims Tim 003@ [X] 100% Sims, Tim
Sims Tim 004@ [X] 100% physical
Sims Tim 005@ [ ] 0% uniform deposit #31
Sims Tim 006@
Smith Sam 007@ [X] 50% Smith, Sam
Smith Sam 008@ [ ] 0% physical
Smith Sam 009@ [X] 100% uniform deposit
Smith Sam 010@
Comer Hannah 011@ [ ] 0% Comer, Hannah
Comer Hannah 012@ [ ] 0% physical
Comer Hannah 013@ [ ] 0% uniform deposit
Comer Hannah 014@
Thornton Tyler 015@ [X] 100% Thornton, Tyler
Thornton Tyler 016@ [X] 100% physical
Thornton Tyler 017@ [X] 100% uniform deposit #35
Thornton Tyler 018@
which, after sorting, gives
[EMAIL PROTECTED] 100% Soccer Team
002@
Comer Hannah 011@ [ ] 0% Comer, Hannah
Comer Hannah 012@ [ ] 0% physical
Comer Hannah 013@ [ ] 0% uniform deposit
Comer Hannah 014@
Sims Tim 003@ [X] 100% Sims, Tim
Sims Tim 004@ [X] 100% physical
Sims Tim 005@ [ ] 0% uniform deposit #31
Sims Tim 006@
Smith Sam 007@ [X] 50% Smith, Sam
Smith Sam 008@ [ ] 0% physical
Smith Sam 009@ [X] 100% uniform deposit
Smith Sam 010@
Thornton Tyler 015@ [X] 100% Thornton, Tyler
Thornton Tyler 016@ [X] 100% physical
Thornton Tyler 017@ [X] 100% uniform deposit #35
Thornton Tyler 018@
and after removing up to and including the first @ on each line:
[X] 100% Soccer Team
[ ] 0% Comer, Hannah
[ ] 0% physical
[ ] 0% uniform deposit
[X] 100% Sims, Tim
[X] 100% physical
[ ] 0% uniform deposit #31
[X] 50% Smith, Sam
[ ] 0% physical
[X] 100% uniform deposit
[X] 100% Thornton, Tyler
[X] 100% physical
[X] 100% uniform deposit #35
with a blank line at the end.
I had mentioned the line number as part of the sort keys, in order to
keep the lines of each block in the same order. Thinking back on it, it
becomes obvious that the line number has to be padded left to a fixed
length strictly greater than the base-ten logarithm of the number of
lines. (to avoid sorting 9 after 10)
By "block" I mean whatever must stay together, i.e., either the header
with the blank line following it, ot the _four_ lines for each player
(name, physical, uniform, and blank line).
Using a space (which comes before all other printable characters) as
separator between sort keys makes "Smith-Jones, Bernard" sort after
"Smith, Zabulon" but before "Smithson, Arthur" which I think is what is
intended. If sort keys can include spaces, I suppose we can use an
unprintable character which is sure to sort before everything else, like
^A (0x01).
Best regards,
Tony.