in reply to Fast/efficient way of check if a string in an strArr is contained in a line
#!/usr/bin/perl use strict; use warnings; use Regexp::Assemble; my $skip_file = $ARGV[0] or die "Usage: $0 <skip_file>; my $ra = Regexp::Assemble->new(); $ra->add_file($skip_file); my $skip = $ra->re; open(my $fh, '<', 'log.txt') or die "Unable to open 'log.txt' for rea +ding: $!"; while (<$fh>) { next if /$skip/; print; }
Minor addition: Depending on the contents of your skip file, there are other modules that may be a better choice but only you would know that unless you share examples.
Cheers - L~R
|
|---|