Hi, Here is an old answer to your problem from Randy W. Sims. Hope it will helps.
Perhaps you would have to modify the sort to have an numerical. Michel S -----Message d'origine----- De: Randy W. Sims [mailto:[EMAIL PROTECTED] Date: vendredi 23 janvier 2004 10:53 À: Bjorn Van Blanckenberg Cc: Perl Beginners Objet: Re: Reading tab delimited File & sort everything according item 5 of every line On 01/23/04 03:36, Bjorn Van Blanckenberg wrote: > the thing i'am looking for is that it is sorted by item 5 and writes > back to the file > with an extra line if item 5 is different A variation on the Swartzian transform: (read from bottom up) #!/usr/bin/perl use strict; use warnings; print map { $_->[1] . "\n" } sort {$a->[0] cmp $b->[0]} map { chomp; [(split /\t/, $_)[4], $_] } <DATA>; __DATA__ one title state name code1 number two title2 state2 name2 code2 number2 one title3 state3 name3 code3 number3 four title4 state4 name4 code4 number4 six title5 state5 name5 code1 number5 dip title6 state6 name6 code1 number6 fun title7 state7 name7 code2 number7 -----Message d'origine----- De: Boon Chong Ang [mailto:[EMAIL PROTECTED] Date: vendredi 30 janvier 2004 06:18 À: Hanson, Rob; [EMAIL PROTECTED] Objet: sort from the smallest number to the highest number Hi Just say I want to sort the row by using the fifth column data as reference from the smallest the largest number, if using sort, It will give me result like this Abc 12.8 8 "left" 1 1.7 Def 13.8 9 "top" 0 19.7 gef 14.8 9 "left" 0 19.7 Dgf 12.3 9 "right" 4 2.6 bac 12.8 8 "left" 1 3.7 etg 12.8 2 "left" 7 34.7 efg 16.8 5 "right" 0 56.7 baf 32.8 7 "bottom" 5 79.8 cef 16.8 4 "right" 0 89.7 but what I want is like this, what so I do to achieve this effect? Abc 12.8 8 "left" 1 1.7 Dgf 12.3 9 "right" 4 2.6 bac 12.8 8 "left" 1 3.7 Def 13.8 9 "top" 0 19.7 gef 14.8 9 "left" 0 19.7 etg 12.8 2 "left" 7 34.7 efg 16.8 5 "right" 0 56.7 baf 32.8 7 "bottom" 5 79.8 cef 16.8 4 "right" 0 89.7 Thank you & best regards, ABC -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response> -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>