title: how to use grep to match with either whitespace or newline
body: <p>I want to grep a file with a word, say "AAA", and it ends with whitespace or newlines. I know how to write this seperately, as follows, but having problems in combining them (in the sense that it outputs both <code>VVV AAA</code> and <code>AAA VVV</code>).</p>
  
  <pre><code>$echo -e "AAA VVV \nVVV AAA\nBBB" | grep "AAA$" 
  &gt;VVV AAA
  $echo -e "AAA VVV \nVVV AAA\nBBB" | grep "AAA[[:space:]]" 
  &gt;AAA VVV 
  </code></pre>
  
  <p>I have tried using <code>[]</code>, but without success..</p>