Searching for words in textfiles

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello,

I have to write an application that scans textfiles for certain words. I'm
talking about approximately 5000 words. The only way I can think of to do
this is to scan each textfile for each word. This takes a lot of time and a
lot of capacity of my pc. Is there another way to do this task?

Regards,

Raf
 
Raf said:
Hello,

I have to write an application that scans textfiles for certain
words. I'm talking about approximately 5000 words. The only way I
can think of to do this is to scan each textfile for each word. This
takes a lot of time and a lot of capacity of my pc. Is there another
way to do this task?

No. How can you find something if you don't search for it?

I would search each file for all words, not each word in all files. Means:
Search for all words in the first file, then for all words in the second
file, and so on. This makes better use of any kind of data cache. The other
way round, the cache would have "forgotten" the content of the first file if
you start to scan all files for the second word.

So:

for each file
for each word
next
next

NOT:

for each word
for each file
next
next

Though, only a possible optimization.


Armin
 
Back
Top