Angharad has asked for the wisdom of the Perl Monks concerning the following question:
I am about to write a script that takes a particular 'identifier' - just a piece of text really taken from the command line and then I want to go though a number of files within a particular directory and open them up one at a time.
Each of these files would then searched for the one that contains this 'identifier' and then print out the name of that file to the screen.
I'm aware, however, that opening a large number of files once at a time and then searching though them a line at a time just to hunt out a piece of text might be a slow and memory hungry method.
Can anyone think of a sensible approach to writing this script? Any suggestions much appreciated
Each of these files would then searched for the one that contains this 'identifier' and then print out the name of that file to the screen.
I'm aware, however, that opening a large number of files once at a time and then searching though them a line at a time just to hunt out a piece of text might be a slow and memory hungry method.
Can anyone think of a sensible approach to writing this script? Any suggestions much appreciated
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: efficient way of searching though large number of text file in a given directory
by moritz (Cardinal) on Dec 01, 2010 at 16:13 UTC | |
by QM (Parson) on Dec 02, 2010 at 17:03 UTC | |
Re: efficient way of searching though large number of text file in a given directory
by eff_i_g (Curate) on Dec 01, 2010 at 17:28 UTC | |
Re: efficient way of searching though large number of text file in a given directory
by Anonymous Monk on Dec 01, 2010 at 16:32 UTC | |
Re: efficient way of searching though large number of text file in a given directory
by Anonymous Monk on Dec 01, 2010 at 16:39 UTC | |
Re: efficient way of searching though large number of text file in a given directory
by pemungkah (Priest) on Dec 02, 2010 at 01:02 UTC |
Back to
Seekers of Perl Wisdom