title: Read and write a file in groovy
body: <p>I'm new to groovy and SOAP UI free. I'm using a groovy script to drive my test for SOAP UI.</p>
  
  <p>I want to write a script that reads a file of person IDs, removes the first one, sets a property, writes the file back out without the one I just read.</p>
  
  <p>Here's my first cut at it:</p>
  
  <pre><code>List pids = new ArrayList()
  
  new File("c:/dev/pids.csv").eachLine { line -&gt; pids.add(line) }
  
  String pid = pids.get(0);
  testRunner.testCase.setPropertyValue( "personId", pid )
  pids.remove(0)
  
  new File("c:/dev/pids.csv").withWriter { out -&gt;
      pids.each() { aPid -&gt;
          out.writeLine(aPid)
      }
  }
  </code></pre>
  
  <p>The output gets displayed on SOAP UI and the file doesn't get touched. I'm lost.</p>