Thread aus HTML auslesen (24 answers)
Opened by rioc at 2008-04-11 15:24

renee
 2008-04-22 11:59
#108688 #108688
User since
2003-08-04
14371 Artikel
ModeratorIn
[Homepage] [default_avatar]
Vielleicht hilft Dir das hier weiter:
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
#!/usr/bin/perl
#
use strict;
use warnings;
use Data::Dumper;

my $text = <<"EOT";
System Information

    The following parameters were set on the configured target:
        hostname:           markov1
        IP address:         10.X.X.11
        IP address:         10.X.X.2
        IP address:         X.X.X.37
        gateway IP address: 10.X.X.1
        gateway IP address: X.X.X.1
        gateway IP address: X.X.X.1
        gateway IP address: X.X.X.1
        time zone:          MET-1METDST
        DNS IP address:     X.X.X.110
        DNS IP address:     X.X.X.142
EOT

my @lines = split /\n/, $text;
my @ips   = grep{ /(?<!DNS )IP\s+address:/ and /(?<!gateway )IP\s+address:/ }@lines;
print $_,"\n" for @ips;


Code: (dl )
1
2
3
4
rbaecker@test $ perl ip.pl
IP address: 10.X.X.11
IP address: 10.X.X.2
IP address: X.X.X.37
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 aus HTML auslesen