How can I check for a particular word in a file?
For eg
//////a.txt
Here is my first range
A=10
B=20
Here is my second range
A=30
B=40
I started reading each line and once I reach B=20 line, I wanted to go back to the first line “here is my first range” and look for the word first and then call some function.
Similarly once I have read b=40, I wanted to read again line “here is my second range” and look for the word “second” and then call some function.
Could anyone please help me with this?
Thanks.
For eg
//////a.txt
Here is my first range
A=10
B=20
Here is my second range
A=30
B=40
I started reading each line and once I reach B=20 line, I wanted to go back to the first line “here is my first range” and look for the word first and then call some function.
Similarly once I have read b=40, I wanted to read again line “here is my second range” and look for the word “second” and then call some function.
Could anyone please help me with this?
Thanks.
Comment