Too complex data structure?

Discussion in 'Perl Misc' started by robertchen117@gmail.com, Mar 1, 2007.

  1. Guest

    Please ignore my first post for not clear question, here is my issue:

    My log file with a long list like this item:
    Fri Oct 6 00:00:23 2006: TR_execute_task( Lib/Task: library_name1/
    task_name2 run by www.hp.com on 7 targets, out = 257

    I know I can use $task_hash{$taskinfo} += targets; -->count by lib/
    task name. Also need count the bytes according to the lib/task name.
    And problems is I also need to count by time:
    output should like this:

    9:00am - 9:59am
    8,010 task2 lib3 77 targets 200,345 output
    3,221 task12 lib3 12 targets 1,530,234 output
    ....
    10:00am - 10:59am
    .....

    This would need very complex data structure, please help me how to do?
    Do we have hash over hash? What should we implement this?

    Thanks a lot for help...
    , Mar 1, 2007
    #1
    1. Advertising

  2. -berlin.de Guest

    <> wrote in comp.lang.perl.misc:
    > Please ignore my first post for not clear question, here is my issue:
    >
    > My log file with a long list like this item:
    > Fri Oct 6 00:00:23 2006: TR_execute_task( Lib/Task: library_name1/
    > task_name2 run by www.hp.com on 7 targets, out = 257
    >
    > I know I can use $task_hash{$taskinfo} += targets; -->count by lib/
    > task name. Also need count the bytes according to the lib/task name.
    > And problems is I also need to count by time:
    > output should like this:
    >
    > 9:00am - 9:59am
    > 8,010 task2 lib3 77 targets 200,345 output
    > 3,221 task12 lib3 12 targets 1,530,234 output
    > ...
    > 10:00am - 10:59am
    > ....
    >
    > This would need very complex data structure, please help me how to do?
    > Do we have hash over hash? What should we implement this?


    The separation in time slices presents no additional complexity in the
    data structures. Just read the log file line by line, accumulating
    data, until the date/time is beyond the current interval. Then print
    and reset the accumulated data and start again with the last sentence
    read.

    That works if the file is sequential in time, which log files usually
    are.

    Anno

    Anno
    -berlin.de, Mar 1, 2007
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jeff

    complex data structure

    Jeff, Jun 26, 2004, in forum: Perl
    Replies:
    5
    Views:
    507
  2. Waqqas Farooq

    complex data structure in httpcookie

    Waqqas Farooq, Jun 30, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    339
    avnrao
    Jun 30, 2004
  3. spar
    Replies:
    4
    Views:
    312
    Alex Martelli
    Oct 11, 2004
  4. Sigmathaar
    Replies:
    3
    Views:
    320
    Bob Hairgrove
    Dec 6, 2005
  5. Ram
    Replies:
    3
    Views:
    417
    Barry Schwarz
    Mar 24, 2009
Loading...

Share This Page