#!/usr/bin/perl # discard_lines_by_verbs.pl use strict; use warnings; die "Please use suitable files" if (@ARGV != 3); my $dis_verbs = shift @ARGV; my $apr_verbs = shift @ARGV; my $ppaxe = shift @ARGV; open(my $in1, "<", "$dis_verbs") or die "error reading $dis_verbs. $!"; open(my $in2, "<", "$apr_verbs") or die "error reading $apr_verbs. $!"; open(my $in3, "<", "$ppaxe") or die "error reading $ppaxe. $!"; my @dis_dic; my @apr_dic; while (my $f1_line = <$in1>) { chomp($f1_line); @dis_dic = $f1_line; } while (my $f2_line = <$in2>) { chomp($f2_line); @apr_dic = $f2_line; } while (my $f3_line = <$in3>) { chomp($f3_line); if ( index($f3_line, @apr_dic) != -1 ) { print "$f3_line\n"; } elsif ( index($f3_line, @apr_dic && @dis_dic) != -1 ) { print "$f3_line\n"; } else { next; } } close($in1); close($in2); close($in3);