title: Extract value containing in a line from a text file using groovy
body: <p>i want to extract a value of token in a line from a text file.</p>
  
  <p>The line from the text file is:</p>
  
  <pre><code>&lt;response&gt;{"timestamp": "2013-11-12T14:55:43Z", "data": {"profile": null, "ticket": "f644231-6d46-44c7-add6-de3a4422871e", &lt;/response&gt;
  </code></pre>
  
  <p>groovy file is:</p>
  
  <pre><code>    // read the file from path
      def file = new File('c:/tmp/response.txt')
      // for example read line by line
      def data= file.eachLine { line -&gt;
          // check if the line contains your data 
          if(line.contains('"ticket":')){
              return line     
          }
      }
  testRunner.testCase.testSuite.project.setPropertyValue('ticket',data)
  </code></pre>
  
  <p>So here it's not storing any value in my variable ticket.
  Any help, please</p>