title: Using xargs command and two move commands following it
body: <p>OS: aix
  shell: bsh</p>
  
  <p>Hi, ppl</p>
  
  <p>I have two types of files, one type ends with <strong>.pdf.marker</strong> and the other ends with <strong>.pdf</strong></p>
  
  <p>There should be always a pair with the same name (only the extensions are different).</p>
  
  <p>When I move a <strong>.pdf.marker</strong> file I must also move its corresponding <strong>.pdf</strong> file.</p>
  
  <p>I tried something like this:</p>
  
  <pre><code>find ${INPUT_LOCATION}/ -name "*.pdf.marker" | xargs -I file mv file ${OUTPUT_LOCATION}/. mv $(basename file .marker) ${OUTPUT_LOCATION}/. 
  </code></pre>
  
  <p>Then I read this: <a href="https://stackoverflow.com/questions/6958689/xargs-with-multiple-commands-as-arguments">xargs with multiple commands as argument</a>
  and tried something like this:</p>
  
  <pre><code>find ${INPUT_LOCATION}/ -name "*.pdf.marker" | xargs -I file {mv file ${OUTPUT_LOCATION}/.; mv $(basename file .marker) ${OUTPUT_LOCATION}/.;} 
  </code></pre>
  
  <p>but it still didnt work.</p>
  
  <p>I just need to execute 2 commands after xargs.</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>Following the proposed answers I got i tried to put just 2 parameters into one move command
  instead of two separate move commands following xargs.</p>
  
  <pre><code>find ${INPUT_LOCATION}/ -name "*.pdf.marker" | xargs -I file mv file $(basename file .marker) ${OUTPUT_LOCATION}/. 
  </code></pre>
  
  <p>But now, the <strong>.pdf.marker</strong> is moved first, then when I try to remove the <strong>.marker</strong> from the filename to get the <strong>.pdf</strong> filename i get a warning no such file or directory. </p>
  
  <p>Is there another way to get <strong>.pdf</strong> filename string?</p>
  
  <p><strong>SOLUTION</strong></p>
  
  <pre><code>find ${INPUT_LOCATION} -name '*.pdf.marker' -exec sh -c 'mv $0 `dirname $0`/`basename $0 .marker` $1' {} ${OUTPUT_LOCATION} \;
  </code></pre>
  
  <p>Moved 200 000 files in cca. 25  min. without problems.</p>
  
  <p>Thanks everyone who participated with their answers and a <strong>big thanks</strong> goes to you Nahuel Fouilleul!</p>