title: Removing specific text from each line
body: <p>I have about thousand lines of the type:</p>
  
  <pre><code>&lt;option value="1436"&gt;Some text
  &lt;option value="36"&gt;Some text
  </code></pre>
  
  <p>I want to store a fresh file, without <code>&lt;...&gt;</code> part in it.
  The code I'm writing is:</p>
  
  <pre><code>try{
      FileInputStream fs= new FileInputStream(f);
      Scanner s= new Scanner(fs);
      while (s.hasNext()){
          String sentence=s.nextLine();
          int l=sentence.length();
          try{//printing P
              BufferedWriter bw = new BufferedWriter(new FileWriter("Ps.txt"));
              for (int i=0;i&lt;l;i++){
                  if (sentence.charAt(i)=='&gt;'){
                      for (int j=i+1;j&lt;l;j++)
                      bw.write(sentence.charAt(j));
                  }
                  bw.newLine();
              }
              bw.close();
          }   
          catch(Exception e){}
      }
  }
  </code></pre>
  
  <p>However, it just storing 3-4 lines in the output file.</p>