grep -vf exclude.list mail.list > new.list #### #!/usr/bin/perl -w # # only-in # find lines which are in the first file, but not in the second. # use strict; die "Usage: $0 INPUT EXCLUDE\n" unless($#ARGV == 1); my $input_file = shift; my $exclude_file = shift; open (INPUT, $input_file ) || die("Can't open input file '$input_file': $!\n"); my @input = (); close(INPUT); open (EXCLUDE, $exclude_file ) || die("Can't open exclude file '$exclude_file': $!\n"); my @exclude = (); close(EXCLUDE); my @good; for my $data (@input) { push (@good, $data) unless(grep /^$data$/i, @exclude); } print join("", @good);