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

renee
 2007-01-04 21:11
#72879 #72879
User since
2003-08-04
14371 Artikel
ModeratorIn
[Homepage] [default_avatar]
Oder ohne Module:
Code: (dl )
1
2
3
4
5
6
7
8
9
10
my $file = '/path/to/file';
my $line_start = 'BB';
my $search = 'wort3';

open my $fh,'<',$file or die $!;
while(my $line = <$fh>){
next unless $line =~ /^\Q$line_start\E/;
print "yes\n" if $line =~ /\Q$search\E/;
}
close $fh;


CPAN:Tie::File ist aber ein guter Hinweis von MisterL
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