Clear questions and runnable code get the best and fastest answer |
|
PerlMonks |
Re: remove lines matching list of stringsby TomDLux (Vicar) |
on Nov 08, 2012 at 21:51 UTC ( [id://1002996]=note: print w/replies, xml ) | Need Help?? |
English translation: using the Unix grep command, search file1 for lines which do not match ( -v ) the fixed strings ( -F ) ( as opposed to regular expressions ) found in file2 ( -f file2 ). There are versions of grep available for Windows. Mac OS has a Unix basis, so it already has it. If you absolutely have to do it in Perl, I would use the lines from file2 as the keys of a hash, assigning the number 1 as a value. Then, as I read the other file, it's trivial to check whether it is present in the hash. As Occam said: Entia non sunt multiplicanda praeter necessitatem.
In Section
Seekers of Perl Wisdom
|
|