Re: Re: Human readable sort

2009-05-21 Thread knome . net

On May 21, 2009 5:07pm, Giuseppe Scrivano gscriv...@gnu.org wrote:


I think this is a too strong assumption. I wouldn't be surprised to



find, for example, both 1M and 1500K in a data set.



I initiated this to patch sort primarily to support the data generated by  
df, du and ls. The human readable options these offer are often frustrating  
once a user realizes there is not a complimentary sort option to them.  
These, of course, do produce properly reduced data.



Does anyone know of a tool which produces mixed data of this sort that  
would need normalized unit comparison?




Are there problems to normalize values using this pseudo-code?



while (abs (a)  1000) //or 1024



{



order_a += signum (a);



a /= 1000; //or 1024



}



Yes. The current implementation does not convert to a numeric  
representation but compares the numbers character by character instead.


The patch rides on top of this functionality, just adding a check to scan  
ahead for units and assuming that difference of unit is sufficient for  
determining sort order.


Anything more complex will probably have to extend the number comparison  
code found in strnumcmp-in.h.


- Michael Speer
___
Bug-coreutils mailing list
Bug-coreutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-coreutils


Re: Re: Human readable sort

2009-04-27 Thread knome . net

On Apr 27, 2009 11:41am, Ondřej Vašík ova...@redhat.com wrote:

Pádraig Brady wrote:



 Pádraig Brady wrote:



 Attached is the full patch, which hopefully we can push soon.





I'm not objecting anything relevant in that patch, just the tab/spaces



mixing looks inconsistent with the rest of the code in added lines in



sort.c . Only cosmetic thing ... but is this intentional?





Greetings,



Ondřej Vašík



That is my fault. My home and work emacs are configured with tabs disabled  
for interaction with my office and home repos. I'll do cleanup against the  
patch this afternoon when I can look at it.


-Michael speer
___
Bug-coreutils mailing list
Bug-coreutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-coreutils