in reply to Reading a Log File - "pattern detection" Part 2
Or, more verbosely:perl -ne 'print if /^("This is really important"|"This is very importa +nt to you"|"This is also important")$/' dread.log > warnings.txt
The hardest part is getting the regexes right, to match only lines you're interested in. To be more accurate, you have to provide a realer (?) example.use strict; use warnings; open DREAD, "dread.log" or die "Can't open input file"; open OUT, ">warnings.txt" or die "Can't open output file"; while (<DREAD>) { print OUT if /^("This is really important"|"This is very important t +o you"|"This is also important")$/; } close DREAD; close OUT;
|
|---|