Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Read and search for text in a file

 
Hari MohanSingh
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have a file like this
ABCD 123 blah blah
int varx;
string varb;

xyz = varb;

blah blah

What I need to do:
search in the file for xyz and find varb and then find
string varb;
and extract what it is a string.

so the definition of varb is before it is used, so I need to find if it is used and then find what it is defined as.

How do I do this? The file will be Unix formatted but stored locally on a DOS machine.
Thanks
 
Campbell Ritchie
Sheriff
Pie
Posts: 49457
64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you know how to find a String inside a String?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic