Thread unnötiges löschen? (5 answers)
Opened by Gast at 2008-01-21 14:54

renee
 2008-01-21 15:04
#104981 #104981
User since
2003-08-04
14371 Artikel
ModeratorIn
[Homepage] [default_avatar]
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
#!/usr/bin/perl

use strict;
use warnings;

my $file = 'dutno.txt';
my @entries;

{
   my $measure;
   local $/ = "\nDUT No\n";
   open my $fh, '<', $file or die $!;
   while( my $entry = <$fh> ){
      chomp $entry;
      my @mms = $entry =~ /Measurement:\s*([\d.]+)/;
      $measure = $mms[0] unless defined $measure;
      if( grep{ $_ == $measure }@mms ){
         $entry = "DUT No\n". $entry unless $entry =~ /^DUT No/;
         push @entries, $entry;
      }
   }
}


print $_,"\n" for @entries;
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 unnötiges löschen?