Thread Mehrzeiliges Matching
(1 answers)
Opened by mr-sansibar at 2007-05-11 17:32 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 #!/usr/bin/perl use strict; use warnings; use Data::Dumper; my $file = '/path/to/file.txt'; my @array; { local $/ = "\nMessage:"; open my $fh, '<', $file or die $!; while( my $entry = <$fh> ){ chomp $entry; $entry = "Message:".$entry unless $entry =~ /^Message/; push @array,$entry; } close $fh; } print Dumper(\@array); (ungetestet) 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/ |