Wednesday, March 14, 2018

Re: sorting file content by third numbered column

Le mercredi 14 mars 2018 09:31:24 UTC+1, Ni Va a écrit :
> I have done this explained before. Dict that have total time in key and csv line in value.
>
>
> Then I can do a  reverse(sort( numerical order but I would like to retrieve values and the code above retrieve keys sorted.....
> so I need the last step.
>
>
> .
> .
>
>    let line = funclass.s:sep.string(nOccur).s:sep.sumstr.s:sep.indicateur
>    call extend(s:sorted_by_total_time, {sumstr : line})
>
>   endfor
>  
> let s:results_by_total_time = reverse(sort(keys(s:sorted_by_total_time),'N'))
>
>
>
>
>
>
>
>
>
> 2018-03-14 8:53 GMT+01:00 Christian Brabandt <cblists@256bit.org>:
>
>
> On Di, 13 Mär 2018, Ni Va wrote:
>
>
>
> > > Oh and BTW: please trim your quotes and write your statement below to
>
> > > what you are referring to.
>
>
>
> Please trim your quotes.
>
>
>
> Have you tried using a custom compare function similar to what is
>
> written to the help at :h sort()?
>
>
>
> BTW: please provide a minimal working example of what problem you are
>
> trying to solve. I am not trying to debug your complex script. Sorry.
>
>
>
>
>
> Best,
>
> Christian
>
> --
>
> Es ist nicht genug, der Natur die Daumenschrauben anzulegen.
>
> Man muß auch hinhören, wenn sie aussagt.
>
>                 -- Arthur Schopenhauer
>
>
>
>
>
> --
>
> --
>
> You received this message from the "vim_use" maillist.
>
> Do not top-post! Type your reply below the text you are replying to.
>
> For more information, visit http://www.vim.org/maillist.php
>
>
>
> ---
>
> You received this message because you are subscribed to a topic in the Google Groups "vim_use" group.
>
> To unsubscribe from this topic, visit https://groups.google.com/d/topic/vim_use/rjR-W-7MQNc/unsubscribe.
>
> To unsubscribe from this group and all its topics, send an email to vim_use+unsubscribe@googlegroups.com.
>
> For more options, visit https://groups.google.com/d/optout.

Would like to use map( but this seems to do the job.

let s:results_by_total_time = []
for key in reverse(sort(keys(copy(s:sorted_by_total_time )),'N'))
call add(s:results_by_total_time, s:sorted_by_total_time[key])
endfor

Thank you.

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments: