pglinx has asked for the wisdom of the Perl Monks concerning the following question:
File entries are in this format "LName","FName","Zip","County","Town" code is here $log_name = "zipfile.txt"; my $exclude = "$input{'FName'}, $input{'LName'}, $input{'county'}"; my @excludes = split (/ /,$exclude); local @ARGV = ($log_name); local $^I = '.bak'; LOOP: while (<>) { foreach my $entry (@excludes) { next LOOP if (/$entry/); } print; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Matching and removing a line from a file
by jethro (Monsignor) on Dec 10, 2008 at 04:20 UTC | |
|
Re: Matching and removing a line from a file
by jwkrahn (Abbot) on Dec 10, 2008 at 03:32 UTC | |
|
Re: Matching and removing a line from a file
by ikegami (Patriarch) on Dec 10, 2008 at 03:02 UTC | |
by AnomalousMonk (Archbishop) on Dec 10, 2008 at 03:57 UTC | |
by ikegami (Patriarch) on Dec 10, 2008 at 05:51 UTC |