title: How to print only the filename part of files that contain a certain string?
body: <p>I need to print out the filename (e.g. <code>A001.txt</code>) that contains the string "XYZ".
  I tried this:<br>
  <code>grep -H -R "XYZ" ~/directory/*.txt | cut -d':' -f1</code>  </p>
  
  <p>It would output the entire path (e.g. <code>~/directory/A001.txt</code>). How can I make it so that it would only output the filename (e.g. <code>A001.txt</code>)?</p>