Fastest way to search text file for string

J

John Price

Why not stop feeding this troll opportunities for further bandwidth waste

No, please don't stop. This is a fascinating insight into the behaviour of a
troll who has not yet realised he's totally out classed by the shear
professionalism of an expert (Julie). I look forward to a good laugh and
just wonder if he will every get the message and realise how ridicules his
stance is. But somehow I don't think he ever will ... as he's a troll by
nature.

John.
 
D

Daniel O'Connell [C# MVP]

Bill Woodruff said:
Why not stop feeding this troll opportunities for further bandwidth waste
?

Where exactly do you see trolls?

Everyone paticipating in this thread are rather common posters.
 
M

Michael C

Interesting. 5 seconds was your worst case scenario? (i.e., Rebooted
machine to ensure there are no files cached, and the string you're searching
for is at the very end of the 100 MB file?) Congrats! Sometimes the
simplest answer is the best.

Now if you had no line breaks (bad assumption on my part when I saw the word
'unstructured'), you'd probably have to read in a chunk of the file, search
it, read in the next chunk, scan it, etc., and of course in between chunks
you'd have to save the last n characters of a chunk and append them to the
front of the next chunk (where n is the size of the search string minus one
character) to ensure that you don't miss any matches that cross boundaries.

Thanks,
Michael C., MCDBA
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top