title: Sending command output to a unique file using xargs in Bash
body: <p>I am trying to run a number of processes dynamically on a fixed number of processors. I want to print the output to a unique file for each process but there is some problem with xargs not using the in-place filename to create a separate file for each process. </p>
  
  <p>The Bash script calls a Csh script and is below:</p>
  
  <pre><code>$ cat temp | xargs -P 8 % csh '%'.csh &gt;&amp; '%'.log
  </code></pre>
  
  <p>Where temp is a text file of csh command names. </p>
  
  <p>My problem is that xargs takes <code>%.log</code> literally and constantly overwrites the file as the processes write to it, rather than having seperate <code>.log</code> files as desired.</p>
  
  <p>I run this script as <code>$ bash run.bash &amp;</code></p>