Reading & Searching in a text file

Reading & Searching in a text file

Post by Perkas » Sat, 09 Jul 2005 18:14:35


Hello,

I want to search some data in a text file, that file has text
and data both. But i don't know how can we search some particular
words in whole text file, Is there any function with which we can
find any string in the text file.

If anyone could help it would be very greatful.
Thanks
 
 
 

Reading & Searching in a text file

Post by BULL DO » Sat, 09 Jul 2005 20:06:55


I did:

fid=fopen(filename);
<stuff>
while feof(fid)==0
line=fgetl(fid);
if ~isempty(findstr(line,searchstring))
<stuff>

The bit in the if statement decides whether the text you are
interested in is there.

Very low-level programming, this, but it works. Admittedly not very
elegant, so I hope someone comes up with something better.

 
 
 

Reading & Searching in a text file

Post by Perkas » Sat, 09 Jul 2005 20:46:12

Thanks alot, I hope this will work for me.



particular
can