title: Use output of one command as replacement text in sed
body: <p>I have a .env file with a bunch of key-value pairs like so:</p>
  
  <pre><code>NAME=John Doe
  CITY=Timbuctoo
  CSS=&lt;some value&gt;
  PORT=3000
  </code></pre>
  
  <p>It is the third line I'm trying to change programmatically.  is a dynamically-generated md5 hash and each time I run the command, it needs to be replaced by a new hash. This is how I'm generating the hash:</p>
  
  <pre><code>$ date +%s | md5sum | cut -d' ' -f 1
  </code></pre>
  
  <p>And I wish to use the output of the above command as the replacement text when using sed. But can't figure out how to make it work. The following is the solution I have so far which is far from complete:</p>
  
  <pre><code>$ date +%s | md5sum | cut -d' ' -f 1 | sed -i.bak 's/^\(CSS=\).*/replacement/' ~/nano/.env
  </code></pre>
  
  <p>What should put in place of "replacement" to ensure the original value gets replaced by the value returned by <code>cut</code>?</p>