LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Load text file into memory for searching?

Can you loop through the file once, but loop through the keys?

do until eof
read a record
for each key
check it, write it (a combined file or new file for each key???)
next key
loop



J@Y wrote:

That is essentially what I am doing right now. I am searching through the big
file to pull out sections into another text file. For example, I had 13 keys
I was searching and it returned me another text file with 13 paragraphs That
takes about 2 minutes because it literally runs through the whole text file
13 times. What I like to know is if there's any way of speeding that process
up.

Thanks.

"Dave Peterson" wrote:

Maybe you could look for your keys in the text file and create a new (much, much
smaller) text file based on what you find.



J@Y wrote:

It is. Because right now, I have something that searches through the text
line by line with textCompare and it is quite slow (averaging about 3-4
seconds per search). Will the Binary method help in speeding things up?

I remember a friend once told me that if you load a text file into memory
and perform binary search, the maximum amount of time is equal to Log(N) vs
if you read it line by line its maximum time is N. I'm new to programming so
if someone can enlighten me on this, it'll be much appreciated.

"NickHK" wrote:

Check out the Open statement in the VBA Help: Their example of
Open "TESTFILE" For Binary Access Write As #1

However, if this is connected with your 1 ~ 5 million row text file, you
will probably have to do it in chunks.

NickHK

"J@Y" wrote in message
...
Is it possible to load a text file into memeory and perform binary
searches
to increase speed?




--

Dave Peterson


--

Dave Peterson
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Code for searching & copying Text from 1 text file to another J@Y Excel Programming 2 June 27th 07 04:16 PM
load/parse large text file Keith R Excel Programming 10 April 9th 07 09:49 PM
load a CSV file and have it take all fields as text cj Excel Discussion (Misc queries) 5 March 29th 07 02:24 PM
Can I load text file into Excel seting field delimter using cmd li Tim Excel Discussion (Misc queries) 0 April 19th 05 01:55 AM
Load text file and write back sanjay Excel Programming 1 May 26th 04 03:28 AM


All times are GMT +1. The time now is 12:39 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"