text files - Finding a word and copying the line it's in in Java -


I am trying to create a small program that allows you to search for a word in a text file, And then the program

example:

  test.txt Ignore this lesson  

and then when If you search for the word "text", then it should print "Do not ignore this text"

What is the best way to do this?

This is what I have;

  Find public boolean file in (cache) (try (bufftterdr BR = new buffed reader (new file reader ("direct .ttt")) {while ((name = br.readline ()) = null } {Process P = Runtime.tterinem (.) Exec (name);}} Grip (IOException e1) {} return true;}  

Comments