Perhaps you could read all of the lines from your second file, before starting to process the first, and construct a single regular expression with all of the strings you want to exclude.
johngg@shiraz:~/perl/utils$ perl -Mstrict -Mwarnings -E '
open my $file2FH, q{<}, \ <<__EOD2__ or die $!;
/dumpx/DUMP4X/var/level6/55
/dumpx/DUMP4X/var/level7/58
__EOD2__
my $rxExcl = do {
chomp( my @lines = <$file2FH> );
local $" = q{|};
qr{@lines};
};
close $file2FH or die $!;
open my $file1FH, q{<}, \ <<__EOD1__ or die $!;
/dev/sda3 6 Fri Apr 12 04:27:19 2019 +0100 /dumpx/DUMP3X/var/level6/
+47 81.34 MB
/dev/sda4 6 Fri Apr 12 04:30:02 2019 +0100 /dumpx/DUMP4X/var/level6/
+55 86.53 MB
/dev/sdb1 6 Fri Apr 12 04:31:47 2019 +0100 /dumpx/DUMP4X/var/level6/
+56 27.73 MB
/dev/sdb2 6 Fri Apr 12 04:33:33 2019 +0100 /dumpx/DUMP4X/var/level7/
+58 57.32 MB
__EOD1__
while ( <$file1FH> )
{
print unless m{$rxExcl};
}
close $file1FH or die $!;'
/dev/sda3 6 Fri Apr 12 04:27:19 2019 +0100 /dumpx/DUMP3X/var/level6/
+47 81.34 MB
/dev/sdb1 6 Fri Apr 12 04:31:47 2019 +0100 /dumpx/DUMP4X/var/level6/
+56 27.73 MB
I hope this is useful.
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|