Thread Parsen in Perl? (6 answers)
Opened by Gast at 2008-02-06 15:44

Linuxer
 2008-02-06 17:10
#105648 #105648
User since
2006-01-27
3881 Artikel
HausmeisterIn

user image
Schnellschuß:

Code (perl): (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/usr/bin/perl
use strict;
use warnings;

{
        local $/ = "\n\n";

        while ( my $block = <DATA> ) {
                if ( $block =~ m/class\s+(\S+\s\S+).+(Sent\s\d+).*(dropped\s\d+),\s+(overlimits\s\d+)/ms ) {
                        print "$1 $2 $3 $4", $/;
                }
        }
}


__DATA__
class htb 1:11 parent 1:1 prio 0 quantum 13107 rate 1Mbit ceil 1Mbit burst 2909b/8 mpu 0b cburst 2909b/8 mpu 0b level 0
Sent 254574739 bytes 2188533 pkts (dropped 0, overlimits 0)
rate 10587bps 105pps
lended: 2188533 borrowed: 0 giants: 0
tokens: 22234 ctokens: 22234

class htb 1:1 root rate 1500Kbit ceil 1500Kbit burst 3519b/8 mpu 0b cburst 3519b/8 mpu 0b level 7
Sent 595611979 bytes 3444145 pkts (dropped 0, overlimits 0)
rate 16492bps 161pps
lended: 14857 borrowed: 0 giants: 0
tokens: 18432 ctokens: 18432
meine Beiträge: I.d.R. alle Angaben ohne Gewähr und auf Linux abgestimmt!
Die Sprache heisst Perl, nicht PERL. - Bitte Crossposts als solche kenntlich machen!

View full thread Parsen in Perl?