Thread Suche in bestimmten Zeilen nach bestimmtem Wort (28 answers)
Opened by kabazza at 2007-01-04 19:25

renee
 2007-01-09 14:56
#72887 #72887
User since
2003-08-04
14371 Artikel
ModeratorIn
[Homepage] [default_avatar]
Sind die Einträge (AA - EE) irgendwie besonders getrennt? Ist da immer eine Leerzeile dazwischen?

Code: (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#!/usr/bin/perl

use strict;
use warnings;

my $file = '/path/to/file';
open my $fh,"<",$file or die $!;
local $/ = "\nAA";
while(my $entry = <$fh>){
my @lines = split /\n/,$entry;
if($lines[0] =~ /Mercedes/){
print $_,"\n" for @lines[3,4];
}
}
close $fh;
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 Suche in bestimmten Zeilen nach bestimmtem Wort