title: How to copy files found with grep on OSX
body: <p>I'm wanting to copy files I've found with <code>grep</code> on an OSX system, where the <code>cp</code> command doesn't have a <code>-t</code> option. </p>
  
  <p><a href="https://stackoverflow.com/questions/37396487/how-to-copy-files-found-with-grep">A previous posts' solution</a> for doing something like this relied on the <code>-t</code> flag in <code>cp</code>. However, like that poster, I want to take the file list I receive from <code>grep</code> and then execute a command over it, something like: </p>
  
  <p><code>grep -lr "foo" --include=*.txt * 2&gt;/dev/null | xargs cp -t /path/to/targetdir
  </code> </p>