title: Read specific data from a .txt file JAVA
body: <p>I have a problem. I'm trying to read a large .txt file, but I don't need every piece of data that's inside.</p>
  
  <p>My .txt file looks something like this:</p>
  
  <blockquote>
    <p>8000000  abcdefg  hijklmn word word letter</p>
  </blockquote>
  
  <p>I only need, let's say, the number and the first two text positions: "abcdefg" and "hijklmn" and write it to another file after that. I don't know how to read and write just the data that I need.</p>
  
  <p>Here is my code so far:</p>
  
  <pre><code>    BufferedReader br = new BufferedReader(new FileReader("position2.txt"));
      BufferedWriter bw = new BufferedWriter(new FileWriter("position.txt"));
      String line;
  
      while ((line = br.readLine())!= null){
          if(line.isEmpty() || line.trim().equals("") || line.trim().equals("\n")){
              continue;
          }else{
              //bw.write(line + "\n");
              String[] data = line.split(" ");
              bw.write(data[0] + " " + data[1] + " " + data[2] + "\n");
          }
  
      }
  
      br.close();
      bw.close();
  
  }
  </code></pre>
  
  <p>Can you give me some sugestions ?
  Thanks in advance</p>
  
  <p>UPDATE: 
  My .txt files are a bit weird. Using the code above works great when there is only one single " " between them. My files can have a \t or more spaces, or a \t and some spaces between the words. Ho can I proceed now ?</p>