On 10-09-01 07:55 AM, Kryten wrote:
Hi,
I'm very much a beginner.
Could anyone point me in the right direction on how to accomplish the
following, please?
I have a fairly long log file call it file A, it has around 20,000
lines of three element space separated variables.
File A looks like:-
55223 jimmy smith
55224 davy crocket
55227 walter mitty
63256 mickey mouse
..
I also have a .txt file with around 600 of the numbers found in file
A. Cal that File B.
File B looks like:-
63256
55223
..
I need to (quickly as possible) remove all the lines from File A,
whose numbers can be found in File B.
Now, I have this working just fine in Windows Powershell, but it
really slow, as I am foreaching file b into a where-object filter, it
works but takes minutes to run. Based on my limited exposure to perl,
I'm pretty certain that TMTOWTDI !!
Many thanks,
Stuart
Load file B into a hash. Then for each line in A, separate the ID and
check if it's in the hash. If it is, skip it; else print it to the new
file.
--
Just my 0.00000002 million dollars worth,
Shawn
Programming is as much about organization and communication
as it is about coding.
The secret to great software: Fail early & often.
Eliminate software piracy: use only FLOSS.
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/