Thread Bestimmte zeilen einer datei einlesen: zeilen eytrahieren
(4 answers)
Opened by Gast at 2007-03-27 17:33
Wie bekommst Du die Antwort? Als String? Als Datei?
Bei String: Code (perl): (dl
)
1 2 3 4 5 6 7 my $string = "Rückantwort"; my @parts = split /\n\n/,$string; for my $part ( @parts ){ next unless $part =~ m!^\s*Volume!; print $part; } Mit Datei: Code (perl): (dl
)
1 2 3 4 5 6 7 8 9 10 my $file = '/path/to/file'; { local $/ = "\n\n"; open my $fh,'<',$file or die $!; while( my $entry = <$fh> ){ next unless $entry =~ m!^\s*Volume!; print $entry; } } 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/ |