title: Linux: how to move each file into a correspondingly named folder
body: <p>I have a small but interesting task here. I have a list of files with same extension, for ex.</p>
  
  <pre><code>a.abc
  b.abc
  c.abc
  </code></pre>
  
  <p>What I want here is to first create folders called <code>a</code>, <code>b</code>, <code>c</code>... for each <code>.abc</code> file, and then move each one into its folder.</p>
  
  <p>I was able to get the first step done pretty straightforwardly using a cmd line <code>find ... | sed ... | xargs mkdir...</code>, but when I tried to use a similar cmd to move each file into its own folder, I couldn't find the answer. </p>
  
  <p>I'm not fluent with the cmd here, and I have a very fuzzy memory that in <code>find</code> cmd I can use some kind of back reference to reuse the file/directory name, did I remember it wrong? Searched it up but couldn't find a good reference.</p>
  
  <p>Can anyone help me to complete the cmd here?</p>
  
  <p>Thanks. </p>