title: Groovy: extracting strings from space-separated lines
body: <p>So, I got the text file, which basically contains the key/value lines, in each line separated by whitespace.
  What I'm trying do achieve is extract value by key, eg. something which in shell is done like this:</p>
  
  <pre><code>cat textfile|awk '/item1/ {print $2}'
  </code></pre>
  
  <p>and in groovy something like that does the thing:</p>
  
  <pre><code>aa = """
  item1 /first/path
  item2 /another/path
  """
  
  aa.eachLine {
      m = it =~ /item1\s+(.*)/
      if (m.matches()) {
          println m.group(1)
      }
  }
  </code></pre>
  
  <p>But, the question is: how to do that in a nicer/more Groovy way?</p>
  
  <p>regards, Wojtek</p>