title: How to substitue a pattern with a whole array using sed?
body: <p>I have an array, which looks like this:</p>
  
  <pre><code>snakes=(python boa cornsnake milksnake)
  </code></pre>
  
  <p>I was wondering if it's possible to substitute a pattern with a whole array using sed.
  I was thinking about something like this:</p>
  
  <pre><code>sed -i "s/snakes like/&amp; $(echo ${snakes[@]})/g" snakes.txt
  </code></pre>
  
  <p>And have the output here like this separated by <code>,</code> :</p>
  
  <pre><code>snakes like python, boa, cornsnake, milksnake
  </code></pre>
  
  <p>Any ideas or suggestions would be very appreciated.</p>