Thread Regulärer Ausdruck, Zeilenumbruch
(15 answers)
Opened by Teesemmel at 2007-10-17 13:11
Was hältst Du davon?
Code (perl): (dl
)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 #!/usr/local/bin/perl ############################ use strict; use warnings; use Fcntl qw/O_RDONLY O_WRONLY O_CREAT O_EXCL/; my $file = 'testinput.txt'; my $tmp = 'output.txt'; sysopen(INPUT, $file, O_RDONLY) or die "unable to open the input file"; #Datei wird systemnah, nur zum Lesen, geöffnet sysopen(OUTPUT, $tmp, O_WRONLY | O_CREAT) or die "unable to open job2.inp: $!"; while(my $test = <INPUT>){ if( $test =~ /testende/ ){ print OUTPUT "das ist der eingefuegte Text\n"; } print OUTPUT $test; } close (INPUT); close (OUTPUT); 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/ |