title: use variable with grep
body: <p>I am trying to extract values from email header, as the Message ID</p>
  
  <p>The grep do not properly use the previous variable...</p>
  
  <p>Here is my code:</p>
  
  <pre><code>for email in $1/*.eml
  do
  
  MSGID=$(cat ${email} | grep -i 'Message-ID:' |awk '{print $2}')
  M=$(echo "\""${MSGID}"\"")
  SRV="/var/log/maillog"
  echo "${M}"
  
  VER=$(grep -i ${M} ${SRV} | tail -n 1)
  echo ${VER}
  done
  </code></pre>
  
  <p>I am trying to re-encapsule the initial variable MSGID with M variable; Unfortunately I still could not figure this out.</p>
  
  <p>Initial value (input) looks like this:</p>
  
  <pre><code>Message-ID: &lt;COMPUTER123DDF38c28d5e776e4fbdb82e2e92bd9a4373@computer123ddf&gt;
  </code></pre>
  
  <p>The <code>MSGID</code> keep only the string as:</p>
  
  <pre><code>&lt;COMPUTER123DDF38c28d5e776e4fbdb82e2e92bd9a4373@computer123ddf&gt;
  </code></pre>
  
  <p>Then I would like to use this string against a file using <code>grep</code>. Unfortunately the <code>VER</code> command does not trigger anything.</p>
  
  <p>I thought that adding <code>"\""${MSGID}"\""</code> would/should have keep the initial string untouched.</p>