title: Copy lines from a File to another
body: <p>I need to copy a line from a file to another depending on condition
  this is my code </p>
  
  <pre><code>     import org.apache.commons.io.FileUtils;
  
       public class FileCopy {
  
  public static void main(String args[]) throws IOException { 
  
      File source = \\
      File fileToCopyFrom \\
      File target :\\
      if (!target.exists()) {
          target.createNewFile();
      }
  
      PrintStream fstream =new PrintStream(target);
      BufferedReader brSource = new BufferedReader(new FileReader(source));
      BufferedReader brFileToCopyFrom = new BufferedReader(new FileReader(fileToCopyFrom));
  
      String lineSource;
      String lineToCopy;
  
      while((lineSource = brSource.readLine()) != null) {
  
            while ((lineToCopy=brFileToCopyFrom.readLine())!=null) {
      if (lineToCopy.contains(lineSource.substring(lineSource.indexOf("_")+1, lineSource.indexOf(".")-1)))
                  fstream.println(lineToCopy);    
              }
  
          }
  }}
  </code></pre>
  
  <p>but it copy only the first line 
  where is the error?</p>