TStanley has asked for the wisdom of the Perl Monks concerning the following question:
I have the following data file, which has been extracted from a log file in Tuxedo:
TStanley
--------
People sleep peaceably in their beds at night only because rough men stand ready to do violence on their behalf. -- George Orwell
I need to sort this data by the number of milliseconds (execution time), so the above would look like:100644:MWTP_CAT:12002: SERVER:pid=14520:Execution time:TPR015-10:(mill +isec):53 100644:MWTP_CAT:12002: SERVER:pid=15866:Execution time:TPR015-10:(mill +isec):10 100644:MWTP_CAT:12002: SERVER:pid=15866:Execution time:TPR015-10:(mill +isec):33 100644:MWTP_CAT:12002: SERVER:pid=16565:Execution time:TPR007-12:(mill +isec):437 100644:MWTP_CAT:12002: SERVER:pid=16565:Execution time:TPR007-12:(mill +isec):470 100644:MWTP_CAT:12002: SERVER:pid=16048:Execution time:TPR009-30:(mill +isec):24 100644:MWTP_CAT:12002: SERVER:pid=15866:Execution time:TPR012-01E:(mil +lisec):63 100644:MWTP_CAT:12002: SERVER:pid=10427:Execution time:ISCST044:(milli +sec):0 100644:MWTP_CAT:12002: SERVER:pid=15866:Execution time:TPR012-01E:(mil +lisec):85 100644:MWTP_CAT:12002: SERVER:pid=10428:Execution time:01201E:(millise +c):3
I know that the sort feature I need specifically would be sort { $a cmp $b } but I am unsure as to how I would extract and sort. As always, just give pointers in the right direction. Thanks.100644:MWTP_CAT:12002: SERVER:pid=16565:Execution time:TPR007-12:(mill +isec):470 100644:MWTP_CAT:12002: SERVER:pid=16565:Execution time:TPR007-12:(mill +isec):437 100644:MWTP_CAT:12002: SERVER:pid=15866:Execution time:TPR012-01E:(mil +lisec):85 100644:MWTP_CAT:12002: SERVER:pid=15866:Execution time:TPR012-01E:(mil +lisec):63 100644:MWTP_CAT:12002: SERVER:pid=14520:Execution time:TPR015-10:(mill +isec):53 100644:MWTP_CAT:12002: SERVER:pid=15866:Execution time:TPR015-10:(mill +isec):33 100644:MWTP_CAT:12002: SERVER:pid=16048:Execution time:TPR009-30:(mill +isec):24 100644:MWTP_CAT:12002: SERVER:pid=15866:Execution time:TPR015-10:(mill +isec):10 100644:MWTP_CAT:12002: SERVER:pid=10428:Execution time:01201E:(millise +c):3 100644:MWTP_CAT:12002: SERVER:pid=10427:Execution time:ISCST044:(milli +sec):0
TStanley
--------
People sleep peaceably in their beds at night only because rough men stand ready to do violence on their behalf. -- George Orwell
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Sorting records on a single field
by jwkrahn (Abbot) on Jan 20, 2010 at 17:21 UTC | |
by kikuchiyo (Hermit) on Jan 20, 2010 at 17:39 UTC | |
Re: Sorting records on a single field
by almut (Canon) on Jan 20, 2010 at 17:25 UTC | |
Re: Sorting records on a single field
by ack (Deacon) on Jan 20, 2010 at 17:44 UTC | |
by almut (Canon) on Jan 20, 2010 at 18:05 UTC | |
by ack (Deacon) on Jan 21, 2010 at 18:18 UTC | |
Re: Sorting records on a single field
by Anonymous Monk on Jan 20, 2010 at 18:15 UTC | |
Re: Sorting records on a single field
by planetscape (Chancellor) on Jan 21, 2010 at 00:11 UTC | |
Re: Sorting records on a single field
by Lain78 (Initiate) on Jan 21, 2010 at 10:03 UTC | |
by salva (Canon) on Jan 21, 2010 at 10:40 UTC | |
by Lain78 (Initiate) on Jan 21, 2010 at 11:07 UTC | |
by salva (Canon) on Jan 21, 2010 at 11:28 UTC |
Back to
Seekers of Perl Wisdom