Jump to content

sorting UNixdate


DieSucker

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?
Link to comment
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
Link to comment
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.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.