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 9 1082
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
"Crouchie1998" wrote: 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
"kd" <kd@discussions.microsoft.com> schrieb: 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.
Reading a text file line-by-line or blockwise with a progress indicator
<URL:http://dotnet.mvps.org/dotnet/faqs/?id=readfile&lang=en>
--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>
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
"Herfried K. Wagner [MVP]" wrote: "kd" <kd@discussions.microsoft.com> schrieb: 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.
Reading a text file line-by-line or blockwise with a progress indicator <URL:http://dotnet.mvps.org/dotnet/faqs/?id=readfile&lang=en>
-- M S Herfried K. Wagner M V P <URL:http://dotnet.mvps.org/> V B <URL:http://classicvb.org/petition/>
Hi Herfried,
Thanks for your reply.
Is there a work-around for this situation without having to read line-by-line?
Regards,
kd.
"kd" wrote: 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
"Herfried K. Wagner [MVP]" wrote:
"kd" <kd@discussions.microsoft.com> schrieb: 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.
Reading a text file line-by-line or blockwise with a progress indicator <URL:http://dotnet.mvps.org/dotnet/faqs/?id=readfile&lang=en>
-- M S Herfried K. Wagner M V P <URL:http://dotnet.mvps.org/> V B <URL:http://classicvb.org/petition/>
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
"Herfried K. Wagner [MVP]" wrote: "kd" <kd@discussions.microsoft.com> schrieb: 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.
Reading a text file line-by-line or blockwise with a progress indicator <URL:http://dotnet.mvps.org/dotnet/faqs/?id=readfile&lang=en>
-- M S Herfried K. Wagner M V P <URL:http://dotnet.mvps.org/> V B <URL:http://classicvb.org/petition/>
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.
"Cor Ligthert" wrote: 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
KD,
I think that you should try it, however it is of course dependable from the
memory that is available
Cor This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Fadi Komati |
last post by:
Dear All,
I need your help concerning the following.
I am openeing a log file for processing (I need to look for certain
activities)
obviously i keep reading until the end of file.
What i...
|
by: Abhishek |
last post by:
I have a problem transfering files using sockets from pocket pc(.net compact
c#) to desktop(not using .net just mfc and sockets 2 API). The socket
communication is not a issue and I am able to...
|
by: Lokkju |
last post by:
I am pretty much lost here - I am trying to create a managed c++
wrapper for this dll, so that I can use it from c#/vb.net, however, it
does not conform to any standard style of coding I have seen....
|
by: athiane |
last post by:
I want a way to parse out all function names that appear in a couple of
C files.
When the parsing logic finds a function name in a file, it should print
out the Function name, line number and file...
|
by: tomtown.net |
last post by:
Hello
I'm trying to get a single line removed from a text file using a search
pattern (pretty simple: if line contains "NODE1") -> remove line). To
achieve this I's like to operate with only the...
|
by: ume$h |
last post by:
/* I wrote the following program to calculate no. of 'a' in the file
c:/1.txt but it fails to give appropriate result. What is wrong with
it? */
#include"stdio.h"
int main(void)
{
FILE *f;...
|
by: worlman385 |
last post by:
For pointer and non-pointer initialization of an object like
MyCar mycar;
MyCar* mycar = new MyCar();
I heard from other people saying if object i create must live outside
scape, then I use...
|
by: aruna.mysore |
last post by:
Hi all,
I have a specific problem passing a function pointer array as a
parameter to a function. I am trying to use a function which takes a
function pointer array as an argument. I am too sure...
|
by: mohi |
last post by:
hello everyone,
i have a program where i write a structure of 1020B to a file a number
of times and in the next run of the program i have to again write
those structures but by taking some count...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |