title: In groovy, how to replace multiple occurrences on specific lines?
body: <p>I have a build.properties file like:</p>
  
  <pre><code>foo=bar/1.1 
  start=/data/home/hudson/Project-1.1/workspace/1.1
  fred=wilma/workspace/1.1
  </code></pre>
  
  <p>Only on the 2nd line, I want to replace all the 1.1 with 2.2, giving:</p>
  
  <pre><code>start=/data/home/hudson/Project-2.2/workspace/2.2
  </code></pre>
  
  <p>I have come up with a way to do this in groovy, but I have a feeling that I'm going about it wrong:</p>
  
  <pre><code>String result = ''
  text.eachLine { line -&gt;
    if (line =~ /(?m)start=/)
      result += line.replaceAll('1.1', '2.2') + '\n'
    else
      result += line + '\n'
  }
  </code></pre>
  
  <p>Is there a snappy, groovier way to do this?</p>