use strict; use warnings; open (my $IN,"<c:/temp/logbook.log") || die "can not open datei: $!"; print grep /error/i, <$IN>; if ($_ ==0){ my $file = '/temp/ok.txt'; # open FILE, '>', $file or die "Kann Datei $file nicht zum Schreiben +oeffnen: $!\n"; # print FILE "ok!\n"; # close FILE; } close $IN;
In reply to Write a file if grep finds a pattern? by matze77
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |