|< 1 2 3 4 5 >| | 47 Einträge, 5 Seiten |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#!/usr/bin/perl
use strict;
use warnings;
use Regexp::Common qw /net/;
open(INPUT, "<", "Datei.txt") or die "kann Datei.txt nicht lesen: $!\n";
while(<INPUT>) {
print $1, "\n" if /IP-Adresse.*:\s*($RE{net}{IPv4})/;
}
close(INPUT);
1
2
3
4
5
6
if ( /Subnetzmaske\.*?:\s*($RE{net}{IPv4})/) {
print "Subnetmask: $1\n";
}
else {
print "Keine subnetmask gefunden\N";
}
Quote[/quote]# -----8<-----
my $input;
open($input, "<", "Datei.txt") or die "kann Datei.txt nicht lesen: $!\n";
while(<$input>) {
my ($ip) = $line =~ /IP-Adresse\.((?:\d+\.)+\d+)/;
# ----8<----
1
2
3
4
5
my $input;
open($input, "<", "Logfile1.txt") or die "kann Logfile1 nicht lesen: $!\n";
while(<$input>) {
...
}
1
2
3
4
5
<form action="/cgi-bin/comments.pl" method="post">
<p>Bitte Logfilenamen eingeben: <br>
<input name="Logfilename" size="40"> </p>
<p> <input type="submit" value="Ok"></p>
</form>
1
2
3
4
5
<form action="/cgi-bin/comments.pl" method="post">
<p>Bitte Logfilenamen eingeben: <br>
<input name="Logfilename" size="40"> </p>
<p> <input type="submit" value="Ok"></p>
</form>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#! /usr/bin/perl
use strict;
use warnings;
use CGI;
use CGI::Carp qw(fatalsToBrowser);
my $cgi = CGI->new();
print $cgi->header();
my $file = $cgi->param('Logfilenam');
die "$file doesn't exist" unless(-e $file);
open(my $fh, "<$file") or die $!;
while(<$fh>){
print;
}
close $fh;
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
28
29
30
31
32
33
34
35
36
37
38
39
#!/usr/bin/perl -w
use strict;
use CGI;
use CGI::CARP qw(fatalsToBrowser);
print "Content-type: text/html\n\n";
print "<html><head><title>Logfile </title></head><body>\n";
print "<form action =\"/cgi-bin/comments.pl\" method=\"post\">\n";
print "<p><b> Logfilename eingeben </b> <br> \n";
print " <p> <input name =\"Logfilename\" size = \"40\" > </p> \n";
print "<p> <input type = \"submit\" value = \"Ok\" > </p> \n";
print "</form>\n";
print "</body></html>\n";
$a = "logfile-accesspoint-1.txt";
$b = "logfile-accesspoint-2.txt";
my $cgi = CGI->new();
print $cgi->header();
my $file= $cgi->param("Logfilename");
if($file == $a) {
logfile1();
}
elsif($file==$b) {
logfile1();
}
sub logfile1 {
open(LOGFILE1, ">$a") or die "kann $a nicht oeffnen: $!\n";
while(<LOGFILE1>) {
print;
}
sub logfile2 {
open(LOGFILE2, ">$b") or die "kann $a nicht oeffnen: $!\n";
while(<LOGFILE2>) {
print;
}
QuoteCode: (dl )use CGI::CARP qw(fatalsToBrowser);
|< 1 2 3 4 5 >| | 47 Einträge, 5 Seiten |