title: Find specific string in files then delete other files with same filename
body: <p>I need some help making a bash script.</p>
  
  <p>Okay, so lets say I have these 3 types of files in a system:</p>
  
  <pre><code>fe516148-3e8b-4816-8481-6fd079a46ae9.desc
  
  fe516148-3e8b-4816-8481-6fd079a46ae9.meta
  
  fe516148-3e8b-4816-8481-6fd079a46ae9~fe516148-3e8b-4816-8481-6fd079a46ae9.alias
  </code></pre>
  
  <p>I need to find a specific "string" in the <code>.alias</code> files and if I find it in that <code>.alias</code> file I then need to delete the associated <code>.meta</code> and <code>.desc</code> files with the same filename but they have slightly different filenames with an additional name after <code>~</code>. </p>
  
  <p>How would I script this? </p>
  
  <p>I have </p>
  
  <pre><code>find . -name "*.alias" -exec grep -l "string" {} \;
  </code></pre>
  
  <p>and it returns </p>
  
  <pre><code>./fe516148-3e8b-4816-8481-6fd079a46ae9~fe516148-3e8b-4816-8481-6fd079a46ae9.alias
  </code></pre>
  
  <p>which is correct, but now I need it to only return <code>fe516148-3e8b-4816-8481-6fd079a46ae9</code>, then delete all the files with filename <code>fe516148-3e8b-4816-8481-6fd079a46ae9</code> regardless of file extension including the <code>.alias</code> file.</p>
  
  <p>That's as far as I got. </p>