Leser: 13
![]() |
|< 1 ... 6 7 8 9 10 11 12 >| | ![]() |
114 Einträge, 12 Seiten |
1
2
Mailbox Last Logged on By Size (KB) Total Items Last Logon Time Last Logoff Time
Gehring Sabrina Domainname\sa8bw 32 016 85 5.7.2006 16:36 5.7.2006 16:36
1
2
Mailbox Last Logged on By Size (KB) Total Items Last Logon Time Last Logoff Time
Gehring Sabrina Domainname\sa8bw 32 016 85 5.7.2006 16:36 5.7.2006 16:36
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
40
41
42
#!/usr/bin/perl
use warnings;
use strict;
my @data;
my $file = 'mailbox.txt';
open(my $fh,'<',$file) or die $!;
while(my $line = <$fh>) { # alles was unten in __DATA__ steht symbolisiert eine Datei
chomp $line;
my @array = (split(/\s{2,}/,$line))[0..2];
foreach (@array) {
s%^\s+%%g; # fuehrende und
s%\s+$%%g; # abschliessende Blanks entfernen
} # foreach
push(@data,[@array]);
} # while
close $fh;
my $len_vorname = find_longest(map{$_->[0]}@data);
my $len_nachname = find_longest(map{$_->[1]}@data);
my $len_domain = find_longest(map{$_->[2]}@data);
for my $entry(@data){
print sprintf("%-*s %-*s %-*s<<\n",$len_vorname,$entry->[0],
$len_nachname,$entry->[1],
$len_domain,$entry->[2]);
}
sub find_longest{
my $longest = 0;
for(@_){
my $length = length($_);
$longest = $length if($length > $longest);
}
return $longest;
}
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
40
41
42
43
44
#!/usr/bin/perl
use warnings;
use strict;
my @data;
my $file = 'mailbox.txt';
my $delimiter = '\s{2,}';
my $columns = 2;
open(my $fh,'<',$file) or die $!;
while(my $line = <$fh>) { # alles was unten in __DATA__ steht symbolisiert eine Datei
chomp $line;
my @array = (split(/$delimiter/,$line))[0..($columns-1)];
foreach (@array) {
s%^\s+%%g; # fuehrende und
s%\s+$%%g; # abschliessende Blanks entfernen
} # foreach
push(@data,[@array]);
} # while
close $fh;
my $format = '';
for my $i(0..scalar(@{$data[0]})-1){
my $max = find_longest(map{$_->[$i]}@data);
$format .= '%-'.$max.'s ';
}
for my $entry(@data){
print sprintf($format . "<<\n",@$entry);
}
sub find_longest{
my $longest = 0;
for(@_){
my $length = length($_);
$longest = $length if($length > $longest);
}
return $longest;
}
1
2
3
Mailbox Last Logged on By Size (KB) Total Items Last Logon Time Last Logoff Time <<
Gehring Sabrina Domainname\sa8bw 32 016 85 5.7.2006 16:36 5.7.2006 16:36<<
Gehring-Norak Marie Domainname\ma8bw 66 715 457 6.7.2006 6:31 <<
my $length = length($_);
1
2
3
print sprintf("%-*s %-*s %-*s<<\n",$len_vorname,$entry->[0],
$len_nachname,$entry->[1],
$len_domain,$entry->[2]);
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/usr/bin/perl
use strict;
use warnings;
my ($name, $logon, $size);
format STDOUT =
@<<<<<<<<<<<<<<<<<<<< @<<<<<<<<<<<<<<<<<<<< @<<<<<<<<<<<<<<<<<<<<
$name, $logon, $size
.
while(<DATA>) {
next if $. == 1;
chomp;
($name, $logon, $size) = split /\s{2,}/;
write;
}
__DATA__
Mailbox Last Logged on By Size (KB) Total Items Last Logon Time Last Logoff Time
Gehring Sabrina Domainname\sa8bw 32 016 85 5.7.2006 16:36 5.7.2006 16:36
![]() |
|< 1 ... 6 7 8 9 10 11 12 >| | ![]() |
114 Einträge, 12 Seiten |