title: generate a random number/string or an iterator in sed 's/'
body: <p>I adapted <a href="http://www.regular-expressions.info/email.html" rel="nofollow noreferrer">Jan Goyvaerts's e-mail regex</a> to a bash function to be used in pipes to anonymize e-mail addresses:</p>
  
  <pre><code>function remove_emails { 
      sed -r "s|\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\b|email.address@removed.com|gI"; 
  }
  </code></pre>
  
  <p>which I'm using in a bash pipe:</p>
  
  <pre><code>    mysqldump \
          -uuser \
          -ppass \
          db_name \
      | remove_emails \
      | gzip -c \
      | cat \
      &gt; tmp.sql.gz
  </code></pre>
  
  <p>works fine but now, I'd like to have different random e-mails, I'd be satisfied with:</p>
  
  <pre><code>email.address1@removed.com
  email.address2@removed.com
  </code></pre>
  
  <p>or </p>
  
  <pre><code>eiyyzhupzftrvjwehbqp@removed.com
  kwmbrshzmxqlrqatqpff@removed.com
  </code></pre>
  
  <p>or anything that differs and is unique</p>
  
  <p>I'm quite comfortable with bash but using counters, process substitution and so fails as sed is invoked only once, so </p>
  
  <pre><code>sed "s,sth,$(echo $RANDOM),g"
  </code></pre>
  
  <p>and similar won't work, </p>
  
  <p>Is there anything to generate random stuff or counters in sed itself?</p>