• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to find a string in multiple files in a directory.

 
Michael Leibo
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I can find a string in specific file when the file is in the same directory as the .class file. But what I need to do is find a string that exists in multiple files in a directory and it's subdirectories. I know I can "grep" the string and that works fine, but I need to get rid of the "grep" and use java.
the grep command looks like this: "grep -rh 'new FieldSpec[\\s.]' R:\\glog\\server\\agent\\", how would I convert that into java code?
Thanks in advance.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!