title: Linux help: how do you move files to folders based on a .txt file?
body: <p>I have a .txt file containing a column of IDs and their ages (as integers). I've already created separate folders in my directory for each age category (ranging from 20-86). For every ID in my .txt file I would like to move their image (which is currently stored in the folder &quot;data&quot;) to the appropriate folder, based on their age category listed in column two of my .txt file.</p>
  <p>Any help on how to do this in Linux would be really appreciated!</p>
  <p><strong>Updated example with files ending in different suffixes.</strong></p>
  <p>Current working directory:</p>
  <pre><code>data/ 20/ 21/ 22/ 23/ 24/ ...
  </code></pre>
  <p>text file:</p>
  <pre><code>ID001 21
  ID002 23
  ID003 20
  ID004 22
  ID005 21
  </code></pre>
  <p><code>ls data/</code></p>
  <pre><code>ID001-XXX-2125.jpg
  ID002-YYY-2370.jpg
  ID003-XXX-2125.jpg
  ID004-YYY-2370.jpg
  ID005-XXX-2125.jpg
  </code></pre>
  <p>Desired output:</p>
  <pre><code>20/
  ID003-XXX-2125.jpg
  
  21/
  ID001-XXX-2125.jpg
  ID005-XXX-2370.jpg
  
  22/
  ID004-YYY-2370.jpg
  
  23/
  ID002-YYY-2370.jpg
  </code></pre>