Jump to content

Archived

This topic is now archived and is closed to further replies.

DieSucker

sorting UNixdate

Recommended Posts

ok so say that I got a txt file with a bunch of lines like the one below

[code]
Record[0]=CTF-BT-Athletic1000    1955    trs|McN                      1150150175 CTF-BT-Lego    1908    Hazen_Blazen                 1150285451 CTF-BT-w00tw00t_fix    1964    jumper                       1150200327 CTF-BT-andACTION    1989    trs|DieSucker                1150749074[/code]
and then I am spliting each line first at the "=" so then i have just


[code]
CTF-BT-Athletic1000    1955    trs|McN                      1150150175 CTF-BT-Lego    1908    Hazen_Blazen                 1150285451 CTF-BT-w00tw00t_fix    1964    jumper                       1150200327 CTF-BT-andACTION    1989    trs|DieSucker                1150749074[/code]
then spliting it at "\t" so basically i end up with
[code]
CTF-BT-Athletic1000
1955
trs|MCN
1150150175
CTF-BT-Lego
1908
Hazen_Blazen
1150285451


[/code]
so is there anyway to organize all his by unixdate code?

Share this post


Link to post
Share on other sites
what do you mean by organize all this by unixdate code?

Share this post


Link to post
Share on other sites
[!--quoteo(post=388464:date=Jun 27 2006, 06:58 AM:name=hvle)--][div class=\'quotetop\']QUOTE(hvle @ Jun 27 2006, 06:58 AM) [snapback]388464[/snapback][/div][div class=\'quotemain\'][!--quotec--]
what do you mean by organize all this by unixdate code?
[/quote]
well organize by date, each unixdate code has a date associated with it ie 6/26/2006(date(mdY))
so is there anyway to get the most recent dates on top of the list and later ones towards the bottom

Share this post


Link to post
Share on other sites
ok,

first, you need to read them all into an array. You know that a 4 lines will be 1 row, so it'll be easy problem.

then sort the array with ksort, specify the key you wanted to sort. If you specify the key with timestamp, it'll sort by timestamp, and so on.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.