title: How to grep a file using search parameters from another file
body: <p>I am trying to use a file containing IP addresses as the basis for searching through a Cisco firewall configuration file.  Normally, I would use something like:</p>
  
  <pre><code>for i in $(cat ip.file); do grep $i fw.config; done
  </code></pre>
  
  <p>But doing that returns absolutely nothing.  If I put the above script into a file and execute it with the bash -xv flags, each line returns something like this:</p>
  
  <pre><code>+ for i in '`cat ip.file`'
  + grep $'1.2.3.4\r' fw.config  (each IP address is different)
  </code></pre>
  
  <p>grep 1.2.3.4 fw.config is exactly what I want to happen, but I get nothing back from this command.</p>
  
  <p>I know of the grep -f option, but that also returns nothing.  I am not an experienced coder, so I might be overlooking something obvious.</p>