develooper Front page | perl.perl6.users | Postings from June 2018

Re: need sort help

Thread Previous | Thread Next
From:
ToddAndMargo
Date:
June 9, 2018 01:51
Subject:
Re: need sort help
Message ID:
0a98c522-bfe5-8e7b-b17f-6310ad19c042@zoho.com
>> On Fri, Jun 8, 2018 at 5:15 PM, ToddAndMargo <ToddAndMargo@zoho.com 
>> <mailto:ToddAndMargo@zoho.com>> wrote:
>> 
>>     Hi All,
>> 
>>     https://docs.perl6.org/routine/sort
>>     <https://docs.perl6.org/routine/sort>
>> 
>>     How do I fix this?
>> 
>>     $ ls | perl6 -e 'my @x=slurp(); say @x.sort'
>>     (log.06-08-2018_16:07:39.zip
>>     log.06-08-2018_17:07:39.zip
>>     log.07-08-2018_06:07:39.zip
>>     log.07-08-2018_16:07:39.zip
>>     log.12-08-2016_06:07:39.zip
>>     )
>> 
>> 
>>     2016 should be at the top.
>> 
>> 
>>     Many thanks,
>>     -T

On 06/08/2018 06:23 PM, Brent Laabs wrote:
> Rename all of the input files using ISO 8601 dates.  I can't tell, from 
> looking at those numbers, if the first field is the month or the day, so 
> it's impossible to sort data like that with certainty.
> 

That is the way the files come.

The convention being used is
     month, day, year, hour, minute, second

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About