On 2006-08-19, Tim Chase <[EMAIL PROTECTED]> 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
> ==================================================

You can avoid including the sub-lists in the sort key by using vim's 
internal sort, e.g.:

    :'<,'>sort /^.*@/ r

Vim's sort has the property of preserving the order of lines with 
identical keys.  That doesn't solve the problem of the spaces, 
though.  Maybe you could insert <name>@ on the trailing blank lines, 
too.

HTH,
Gary

-- 
Gary Johnson                 | Agilent Technologies
[EMAIL PROTECTED]     | Wireless Division
                             | Spokane, Washington, USA

Reply via email to