Thread Bestimmte Zeilen raussuchen (RegExp?) (10 answers)
Opened by Benny at 2009-07-17 15:54

renee
 2009-07-17 16:16
#123303 #123303
User since
2003-08-04
14371 Artikel
ModeratorIn
[Homepage] [default_avatar]
Code (perl): (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
my $variable = qq~
ds[used].type = "GAUGE"
ds[used].minimal_heartbeat = 20
ds[used].min = 0.0000000000e+00
ds[used].max = 1.1258999068e+15
ds[used].last_ds = "34080235520.000000"
ds[used].value = 3.0672211968e+11
ds[used].unknown_sec = 0
ds[free].type = "GAUGE"
ds[free].minimal_heartbeat = 20
ds[free].min = 0.0000000000e+00
ds[free].max = 1.1258999068e+15
ds[free].last_ds = "24130674688.000000"
ds[free].value = 2.1717607219e+11
ds[free].unknown_sec = 0~;

my @types = $variable =~ /(ds\[[a-z]*\]\.type\s+=\s+[^\n]+)/g;
print $_,"\n" for @types
OTRS-Erweiterungen (http://feature-addons.de/)
Frankfurt Perlmongers (http://frankfurt.pm/)
--

Unterlagen OTRS-Workshop 2012: http://otrs.perl-services.de/workshop.html
Perl-Entwicklung: http://perl-services.de/

View full thread Bestimmte Zeilen raussuchen (RegExp?)