title: How to insert a random string into the sed 's//' replace string for each line actioned?
body: <p>This:</p>
  
  <p><code>echo "    " | tr ' ' '\n' | sed "s|.*|$RANDOM|"</code></p>
  
  <p>Or this:</p>
  
  <p><code>echo "    " | tr ' ' '\n' | sed "s|.*|$(echo $RANDOM)|"</code></p>
  
  <p>Will print a list of 5 numbers (space is replaced by newline, sed replaces each line with $RANDOM), and those 5 numbers <strong>will all be the same</strong>:</p>
  
  <pre><code>$ echo "    " | tr ' ' '\n' | sed "s|.*|$(echo $RANDOM)|"
  21590
  21590
  21590
  21590
  21590
  </code></pre>
  
  <p>This is because the replace of $RANDOM to a random value happens only once.</p>
  
  <p>What is the easiest and shortest way, preferably by only using sed, to actually print a <strong>different</strong> random number for each line. i.e. to provide some "secondary input stream" which differs for each line that sed handles?</p>
  
  <p>I could do it with xargs, but I wonder if there is a way to do it with sed only.</p>