http://www.perlmonks.org?node_id=493602


in reply to Re: When will the 500.000th node appear?
in thread When will the 500.000th node appear?

I guess you'd need some Practical sort of Extraction and Reporting Language for that ...

#!/usr/bin/perl use strict; use warnings; use Time::ParseDate; my @guesses; while (<DATA>) { my ($nic, $dates) = split /\s+/, $_, 2; my ($date) = split /GMT/, $dates; my $esec = parsedate($date); $date =~ s/ (\d) / 0$1 /; $date =~ s/ (\d{2}:\d{2}) / $1:00 /; push @guesses, "$esec $date $nic"; } print join "\n", map {s/\d+\s//;$_} sort @guesses; __DATA__ 5mi11er Mon Oct 17 16:25:00 2005 GMT Tue Sep 20 14:27:03 2005 GMT ambrus Wed Oct 12 17:00:00 2005 GMT Tue Sep 20 11:37:03 2005 GMT aukjan Tue Oct 18 13:33 2005 GMT Tue Sep 20 11:26:47 2005 GMT baldpenguin Sun Oct 23 14:32:00 2005 GMT Tue Sep 20 15:19:01 20 +05 GMT blazar Thu Oct 6 18:03:39 2005 GMT Tue Sep 20 10:50:45 2005 GMT blokhead Mon Oct 31 00:00:00 2005 GMT Tue Sep 20 15:29:54 20 +05 GMT

Some output ...

[root@laptop robin]# ./guess Mon Sep 26 11:27:30 2005 poqui Mon Oct 03 14:05:00 2005 etm117 Thu Oct 06 18:03:39 2005 blazar Mon Oct 10 11:11:00 2005 castaway Mon Oct 10 17:56:00 2005 jcoxen Mon Oct 10 20:00:00 2005 tomte Tue Oct 11 04:24:27 2005 jbrugger Wed Oct 12 12:47:05 2005 ww

Cheers,
R.

Pereant, qui ante nos nostra dixerunt!

Replies are listed 'Best First'.
Re^3: When will the 500.000th node appear?
by ambrus (Abbot) on Oct 03, 2005 at 19:14 UTC

    I've developped a solution independently without reading yours. Here's it.

    I cut and pasted the data from the browser to the file guesses (although it's not visible here, the fields are separated by tabs, as the browser exports the table in that way):

    5mi11er Mon Oct 17 16:25:00 2005 GMT Tue Sep 20 14:27:03 2005 GMT ambrus Wed Oct 12 17:00:00 2005 GMT Tue Sep 20 11:37:03 2005 GMT ... ww Wed Oct 12 12:47:05 2005 GMT Tue Sep 20 12:23:25 2005 GMT zlr Fri Nov 18 13:13:13 2005 GMT Tue Sep 20 15:18:54 2005 GMT

    Then I run this:

    perl -we 'use Date::Manip; while(<>) { /^([^\t]*)\t([^\t]*)\t([^\t]*)$ +/ or die "fmt <<$_>>"; ($ns, $gs, $as) = ($1, $2, $3); $gs =~ /^\w+\s ++(.+)\s+\w+\s*$/ or die "madat $gs"; $d = ParseDate($1) or die "parsd +at $2"; push @l, [sprintf("%-30s %-20s %s", $gs, $ns, $as), $d]; } pr +int map {$$_[0]} sort {Date_Cmp($$a[1], $$b[1])} @l;' < guesses > gue +sses.sort

    Here's the output:

    Sat Sep 24 11:23:34 2005 GMT gri6507 Tue Sep 20 19:35:3 +4 2005 GMT Mon Sep 26 11:27:30 2005 GMT poqui Tue Sep 20 16:01:0 +0 2005 GMT Thu Sep 29 02:44:00 2005 GMT tstanley Sun Sep 25 12:01:2 +3 2005 GMT Mon Oct 3 14:05:00 2005 GMT etm117 Tue Sep 20 10:30:1 +4 2005 GMT Wed Oct 5 12:34:25 2005 GMT sithsasquatch Mon Sep 26 21:56:2 +8 2005 GMT Thu Oct 6 18:03:39 2005 GMT blazar Tue Sep 20 10:50:4 +5 2005 GMT Fri Oct 7 10:31:00 2005 GMT radiantmatrix Wed Sep 21 19:14:0 +8 2005 GMT Mon Oct 10 11:11:00 2005 GMT castaway Tue Sep 20 10:14:1 +2 2005 GMT Mon Oct 10 14:00:00 2005 GMT wazoox Thu Sep 22 14:10:4 +2 2005 GMT Mon Oct 10 17:56:00 2005 GMT jcoxen Tue Sep 20 16:06:1 +9 2005 GMT Mon Oct 10 20:00:00 2005 GMT tomte Tue Sep 20 16:37:3 +3 2005 GMT Tue Oct 11 04:24:27 2005 GMT jbrugger Tue Sep 20 11:16:2 +8 2005 GMT Tue Oct 11 12:34:56 2005 GMT random_walk Wed Sep 21 07:30:5 +2 2005 GMT Wed Oct 12 12:47:05 2005 GMT ww Tue Sep 20 12:23:2 +5 2005 GMT Wed Oct 12 14:33:00 2005 GMT japhy Tue Sep 20 13:56:0 +5 2005 GMT Wed Oct 12 16:24:00 2005 GMT grandfather Tue Sep 20 11:00:5 +9 2005 GMT Wed Oct 12 17:00:00 2005 GMT ambrus Tue Sep 20 11:37:0 +3 2005 GMT Wed Oct 12 19:40:00 2005 GMT talexb Tue Oct 20 21:56:3 +9 2005 GMT Thu Oct 13 18:27:27 2005 GMT qm Tue Sep 20 18:27:0 +7 2005 GMT Thu Oct 13 20:00:00 2005 GMT bobf Tue Sep 27 04:48:5 +2 2005 GMT Fri Oct 14 00:00:00 2005 GMT jmcnamara Tue Sep 20 11:26:4 +5 2005 GMT Sat Oct 15 08:26:04 2005 GMT hue-bond Tue Sep 20 12:54:1 +9 2005 GMT Sat Oct 15 14:00:00 2005 GMT deibyz Fri Sep 23 09:46:1 +3 2005 GMT Sun Oct 16 09:00:00 2005 GMT fireartist Mon Sep 26 13:41:4 +1 2005 GMT Sun Oct 16 15:01:00 2005 GMT chester Sun Sep 25 02:08:3 +0 2005 GMT Mon Oct 17 08:42:00 2005 GMT mcdarren Sun Sep 25 03:20:2 +7 2005 GMT Mon Oct 17 16:25:00 2005 GMT 5mi11er Tue Sep 20 14:27:0 +3 2005 GMT Tue Oct 18 00:00:00 2005 GMT nr0mx Fri Sep 23 18:21:5 +5 2005 GMT Tue Oct 18 13:33 2005 GMT aukjan Tue Sep 20 11:26:4 +7 2005 GMT Wed Oct 19 12:00:00 2005 GMT eric256 Tue Sep 20 14:01:1 +3 2005 GMT Wed Oct 19 17:05:00 2005 GMT errto Tue Sep 20 15:13:3 +8 2005 GMT Fri Oct 21 12:34:00 2005 GMT duct_tape Tue Sep 20 19:19:2 +7 2005 GMT Sun Oct 23 14:32:00 2005 GMT baldpenguin Tue Sep 20 15:19:0 +1 2005 GMT Sun Oct 30 16:00:00 2005 GMT softworkz Thu Sep 22 02:27:4 +5 2005 GMT Sun Oct 30 16:55:00 2005 GMT dawolf Tue Sep 27 01:54:1 +3 2005 GMT Mon Oct 31 00:00:00 2005 GMT blokhead Tue Sep 20 15:29:5 +4 2005 GMT Tue Nov 1 16:25:00 2005 GMT g0n Tue Sep 20 11:52:2 +8 2005 GMT Fri Nov 4 03:00:00 2005 GMT gawatkins Thu Sep 22 16:20:4 +7 2005 GMT Fri Nov 11 11:11:11 2005 GMT natetut Tue Sep 20 15:40:1 +6 2005 GMT Sun Nov 13 12:00:00 2005 GMT rruiz Tue Sep 20 13:30:1 +4 2005 GMT Fri Nov 18 13:13:13 2005 GMT zlr Tue Sep 20 15:18:5 +4 2005 GMT Sat Dec 10 12:00:00 2005 GMT wfsp Tue Sep 20 18:16:4 +0 2005 GMT

      This is kind of fun. It is not pretty and it fails for muba who has bizzarly entered a bet in January 2005 but for the reasonable problem space (Sep .. Dec 2005) it works.

      perl -ne's/ (\d) / 0$1 /;@d=(split)[2..5];$d[0]=~tr/SOND/1234/;push@g,"@d$;$_";END{print$/;print map{(split/$;/)[1]}sort @g}'

      Copy the list from the web page, run the perl, paste the list, hit enter and CTRL-D, or redirect a file with the guess list to the script.

      # some (ugly) output poqui Mon Sep 26 11:27:30 2005 GMT Tue Sep 20 16:01:00 2005 GMT tstanley Thu Sep 29 02:44:00 2005 GMT Sun Sep 25 12:01:23 20 +05 GMT etm117 Mon Oct 03 14:05:00 2005 GMT Tue Sep 20 10:30:14 2005 GMT sithsasquatch Wed Oct 05 12:34:25 2005 GMT Mon Sep 26 21:56:28 20 +05 GMT blazar Thu Oct 06 18:03:39 2005 GMT Tue Sep 20 10:50:45 2005 GMT radiantmatrix Fri Oct 07 10:31:00 2005 GMT Wed Sep 21 19:14:08 20 +05 GMT castaway Mon Oct 10 11:11:00 2005 GMT Tue Sep 20 10:14:12 20 +05 GMT wazoox Mon Oct 10 14:00:00 2005 GMT Thu Sep 22 14:10:42 2005 GMT jcoxen Mon Oct 10 17:56:00 2005 GMT Tue Sep 20 16:06:19 2005 GMT

      update

      perl -ne's/ (\d) / 0$1 /;@d=(split)[2..5];$d[0]=~tr/SOND/1234/;push@g,"@d$;$_";END{print$/;print map{s/.*$;//;$_}sort@g}'

      Cheers,
      R.

      Pereant, qui ante nos nostra dixerunt!