|< 1 2 >| | 16 Einträge, 2 Seiten |
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
sub getDatensatz{
my ($entry) = @_;
my $bool = 0;
my $warte_auf_flanke = 0;
my $set = '';
my @fallend;
for my $line(split(/\r?\n/,$entry)){
chomp $line;
my $wert = (split(/\s+/,$line))[-1];
if($wert > 4.8)
{
$warte_auf_flanke = 1;
}
if($warte_auf_flanke and $wert < 4)
{
$warte_auf_flanke = 0;
$bool = 1;
}
unless($bool){
push(@fallend,$line);
}
else{
$set .= $line."\n";
}
}
$set .= $_."\n" for(@fallend);
$set .= "\n\n";
return $set;
}
1
2
3
4
5
my $last = ( split /\n/, $set )[-1];
$set .= ( $last . "\n" ) x 9;
$set .= $_ . "\n" for (@fallend);
$set .= "\n\n";
return $set;
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
g g g 3
h h h 1
i i i 0
i i i 0
i i i 0
i i i 0
i i i 0
i i i 0
i i i 0
i i i 0
i i i 0
i i i 0
a a a 0
b b b 2
c c c 4
d d d 5
e e e 5
f f f 4
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#! /usr/bin/perl
use strict;
use warnings;
print $ARGV[0];
my $file = $ARGV[0];
my ($in,$suffix) = $ARGV[0] =~ /(.*?)(\.[^\.]+)$/;
my $out = $in.'.cut'.$suffix;
my $count_ = 1;
my $datensatz = '';
{
open(my $outfh,">$out") or die $!;
open(my $fh,"<$file") or die $!;
while(my $entry = <$fh>){
$entry =~ s/\r?\n//g;
if($entry =~ /^\s*?#/){
print $outfh $entry,"\n";
}
else{
if($entry =~ /^\s*?$/){
$count_++;
}
else{
$datensatz .= $entry."\n";
}
if($count_ % 3 == 0){
$datensatz = getDatensatz($datensatz);
print $outfh $datensatz;
$count_ = 1;
$datensatz = '';
}
}
}
if($datensatz){
$datensatz = getDatensatz($datensatz);
print $outfh $datensatz;
}
close $fh;
close $outfh;
}
sub getDatensatz{
my ($entry) = @_;
my $bool = 0;
my $warte_auf_flanke = 0;
my $set = '';
my @fallend;
for my $line(split(/\r?\n/,$entry)){
chomp $line;
my $wert = (split(/\s+/,$line))[-1];
if($wert > 4.8)
{
$warte_auf_flanke = 1;
}
if($warte_auf_flanke and $wert < 4)
{
$warte_auf_flanke = 0;
$bool = 1;
}
unless($bool){
push(@fallend,$_[-1]);
}
else{
$set .= $line."\n";
}
}
my $last = ( split /\n/, $set )[-1];
$set .= ( $last . "\n" ) x 9;
$set .= $_ . "\n" for (@fallend);
$set .= "\n\n";
return $set;
}
|< 1 2 >| | 16 Einträge, 2 Seiten |