Leser: 1
![]() |
|< 1 2 3 4 >| | ![]() |
34 Einträge, 4 Seiten |
1
2
3
use Date::Calc qw(Today_and_Now);
my ($year, $month, $day, $hour, $min, $sec) = Today_and_Now();
1
2
3
4
5
6
7
8
9
10
11
12
13
#!/usr/bin/perl
use strict;
use warnings;
my $line = "AUDIO2-A3.12_P1:project:BmwWtz#1 Wed May 31 13:35:31 2006";
if( $line =~ /([a-zA-Z]{3}) (\d{1,2}) (\d{2}:\d{2}:\d{2}) (\d{4})$/ ) {
print "Monat $1\n";
print "Tag $2\n";
print "Uhrzeit $3\n";
print "Jahr $4\n";
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/usr/bin/perl
use strict;
use warnings;
use Date::Manip;
my @dates;
my @strings = ('AUDIO2-A3.12_P1:project:BmwWtz#1 Wed May 31 13:35:31 2006',
'AUDIO2-A3.17_P1:project:BmwWtz#1 Wed Sep 13 11:22:57 2006',
'AUDIO2-A3.8:project:BmwWtz#1 Mon May 08 18:18:02 2006',);
for my $string(@strings){
my ($date) = $string =~ m!#1 (.*)$!;
push @dates,$date;
}
my @sorted_dates = sort{Date_Cmp($a,$b)}@dates;
print $_,"\n" for(@sorted_dates);
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 strict;
use warnings;
use Date::Calc qw(Date_to_Time);
use Data::Dumper;
$Data::Dumper::Sortkeys = 1;
my @lines = ("AUDIO2-A3.12_P1:project:BmwWtz#1 Wed May 31 13:35:31 2006",
"AUDIO2-A3.17_P1:project:BmwWtz#1 Wed Sep 13 11:22:57 2006",
"AUDIO2-A3.8:project:BmwWtz#1 Mon May 08 18:18:02 2006");
my %months = ( "Jan" => "1",
"Feb" => "2",
"Mar" => "3",
"Apr" => "4",
"May" => "5",
"Jun" => "6",
"Jul" => "7",
"Aug" => "8",
"Sep" => "9",
"Oct" => "10",
"Nov" => "11",
"Dec" => "12"
);
my %sort_dates = ();
foreach my $line (@lines) {
if( $line =~ /(.*) [a-zA-Z]{3} ([a-zA-Z]{3}) (\d{1,2}) (\d{2}):(\d{2}):(\d{2}) (\d{4})$/ ) {
my $version = $1;
my $date = $7.$months{$2}.$3.$4;
my $time = Date_to_Time($7, $months{$2}, $3, $4, $5, $6);
$sort_dates{$time} = $version;
print $version."\n";
print "Monat $2\n";
print "Tag $3\n";
print "Uhrzeit $4:$5:$6\n";
print "Jahr $7\n";
}
}
print Dumper \%sort_dates;
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
use strict;
use warnings;
use Date::Calc qw(Date_to_Time);
use Data::Dumper;
$Data::Dumper::Sortkeys = 1;
my @lines = ("AUDIO2-A3.12_P1:project:BmwWtz#1 Wed May 31 13:35:31 2006",
"AUDIO2-A3.17_P1:project:BmwWtz#1 Wed Sep 13 11:22:57 2006",
"AUDIO2-A3.8:project:BmwWtz#1 Mon May 08 18:18:02 2006");
my %months = ( "Jan" => "1",
"Feb" => "2",
"Mar" => "3",
"Apr" => "4",
"May" => "5",
"Jun" => "6",
"Jul" => "7",
"Aug" => "8",
"Sep" => "9",
"Oct" => "10",
"Nov" => "11",
"Dec" => "12"
);
my %sort_dates = ();
foreach my $line (@lines) {
if( $line =~ /(.*#[0-9])\s+[a-zA-Z]{3} ([a-zA-Z]{3}) (\d{1,2}) (\d{2}):(\d{2}):(\d{2}) (\d{4})$/ ) {
my $version = $1;
my $date = $7.$months{$2}.$3.$4;
my $time = Date_to_Time($7, $months{$2}, $3, $4, $5, $6);
$sort_dates{$time}{'version'} = $version;
$sort_dates{$time}{'date'} = "$7/".$months{$2}."/$3";
}
}
print Dumper \%sort_dates;
![]() |
|< 1 2 3 4 >| | ![]() |
34 Einträge, 4 Seiten |