File pointer to be positioned at the last occurance of a keyword

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

Guest

Hi All,

I have a .txt file, in which I have to look for the last occurance of a
keyword, and process contents of the file from that point onwards.

How can this be achieved? Can anybody guide me?

Thanks,
kd
 
Is there a specific keyword or can it be any?

If one, its easy & if more then create a regex to handle it.

Crouchie1998
BA (HONS) MCP MCSE
 
Hi Crouchie,

It is a specific word that I am looking for. It would be great if you could
post a sample code here.

Thanks,
kd
 
Hi,

I don't think that, reading the text file, line by line and checking for the
keyword is a good idea, because, the file is large and the keyword occurs
several times in the file. I need to only process the data that occurs after
the last occurance of the keyword in the file.

Regards,
kd
 
Hi Herfried,

Thanks for your reply.

Is there a work-around for this situation without having to read line-by-line?

Regards,
kd.
 
Hi Herfried,

The only way to go about this, is to read the file line by line and to the
processing?
Please reply.

Thanks,
kd
 
kd,

Read the rows in using the readline and set the lines in an arraylist

Process that arraylist backwards using the
\\\
For i as integer = arraylist.length - 1 step -1
see if it exist in the lines using the indexof or the instr
Next
///
I hope this helps,

Cor
 
Hi Cor,

Thanks for the reply.

I do however have a question. Would Arraylist be able to store a huge file?
What is maximum capacity of Arraylist?

Regards,
kd.
 
KD,

I think that you should try it, however it is of course dependable from the
memory that is available

Cor
 

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

Back
Top