title: Bean shell script to clear a line from the file after execution in Jmeter
body: <p>I have a condition in Jmeter that the extracted data from the file have to be deleted one by one. Actual situation is, I am getting some IDs from json and saving it in txt file. During my test, I have to delete the Json Content by ID and then I have to clear the text file. Since I am using fragment as test case, while the Thread count increases, the delete statement takes the first line from the txt file and so the same ID getting deleted again and again.</p>
  
  <p>I am using below script to delete the file, but there is no change in the file</p>
  
  <pre><code>try {
              File file = new File("groupId.txt");
              PrintWriter writer = new PrintWriter(file);
              writer.print("");
              writer.close();
              line=$(head -n 1 file)
          } catch (Exception e) {
  
       }
  </code></pre>
  
  <p>Either I have to configure to increase the line index or I have to clear the ID from the txt file after using it.</p>