perl -ne 'print if /^("This is really important"|"This is very important to you"|"This is also important")$/' dread.log > warnings.txt #### 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 () { print OUT if /^("This is really important"|"This is very important to you"|"This is also important")$/; } close DREAD; close OUT;