title: Using SED in a ssh command on a remote node
body: <p>I wrote a script to ssh to some nodes and run a <code>sed</code> command inside the node. The script looks like</p>
  
  <pre><code>NODES="compute-0-3"
  for i in $NODES 
  do
    echo $i
    ssh $i 'sed -i \'s/172.16.48.70/172.20.54.10/g\' /etc/hosts;'
  done
  </code></pre>
  
  <p>However, the error is </p>
  
  <pre><code>unexpected EOF while looking for matching `''
  syntax error: unexpected end of file
  </code></pre>
  
  <p>It seems that the character <code>'</code> is not treated as the begining of a <code>sed</code> command.</p>