Paws_of_Iron has asked for the wisdom of the Perl Monks concerning the following question:
Can't find Unicode property definition "R" at c:/remove.pl line 23, <CURRENTDAT> line 8.
Line 8 is the last line in the file test.dat (this error changes if I add lines it is always the last line). Line 23 is the pattern match part of the code. If I print the lines as it goes it is less than half way through Bad_Shares.TXT and the line changes as I add lines to test.dat (running out of memory?). This is my early test script before I get it to go through a list of files in a given directory (lots of DATs containing drives to map for specific users).
Any help appreciated. I also tried VBS got close but what a nightmare!
# Open the file containing the matches to remove open(BADSHARES, "c:/testy/Bad_Shares.txt"); @BadShares = <BADSHARES>; # Open the file/s to remove these matches from open(CURRENTDAT, "c:/testy/test.dat"); @DatLines = <CURRENTDAT>; # For each line in the file to match from for ($a = 0; $a < scalar(@DatLines); $a++) { # Go through each line of the file to remove these matches from for ($i = 0; $i < scalar(@BadShares); $i++) { # If the current line in the DAT matches any line in the file to m +atch set that line to zero # print "$DatLines[$a] $BadShares[$i]"; if ($DatLines[$a] =~ m/($BadShares[$i])/i) { print "MATCH $DatLines[$a] $BadShares[$i]"; # $DatLines[$a]="" } } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Remove lines from a list of files based on those in a given file
by GrandFather (Saint) on Jan 30, 2006 at 23:32 UTC | |
by Paws_of_Iron (Initiate) on Jan 31, 2006 at 02:24 UTC | |
by GrandFather (Saint) on Jan 31, 2006 at 02:36 UTC | |
by Paws_of_Iron (Initiate) on Jan 31, 2006 at 03:47 UTC |