title: xargs echo `echo {} | sed 's/pattern/replace/'` doesn't work but for each loop works
body: <p>I want to do the equivalent of: </p>
  
  <pre><code>for i in `ls -1`; do echo $i | mv $i `sed 's/profile/account/'`; done
  </code></pre>
  
  <p>with <code>xargs</code></p>
  
  <pre><code>ls -1 | xargs -I{} mv {} `echo {} | sed 's/profile/account/'`
  </code></pre>
  
  <p>But the <code>sed</code> after the pipe within backticks is ignored.
  Anyone know why that's the case? </p>
  
  <h2>Edit: More info</h2>
  
  <p>The root problem is simply to rename files in a directly given a pattern replacement (here replace <code>profile</code> with <code>account</code>, however that is solved with <code>for in</code> loop over the files. </p>
  
  <h3>The question I'm posing is why is the following not working.</h3>
  
  <pre><code>ls -1 | xargs -I{} mv {} `echo {} | sed 's/profile/account/'`
  </code></pre>
  
  <p>Why does the </p>
  
  <pre><code>`echo {} | sed 's/profile/account/'`
  </code></pre>
  
  <p>portion not return the replaced filename but the original filename. It's as if the <code>|</code> doesn't work inside the backticks. </p>
  
  <h3>To write the problem differently:</h3>
  
  <p>If I have a list like in a file called <code>list.txt</code></p>
  
  <pre><code>profile1.txt
  profile2.txt 
  </code></pre>
  
  <p>And want to generate </p>
  
  <pre><code>account1.txt
  account2.txt 
  </code></pre>
  
  <p>While operating on each individual line separately so I can run a command on it. </p>
  
  <pre><code>cat list.txt | xargs -I{} echo `echo {} | sed 's/profile/account/'`
  </code></pre>
  
  <p>Why does command return:</p>
  
  <pre><code>profile1.txt
  profile2.txt 
  </code></pre>
  
  <p>Instead of changing profile to account?</p>