I am trying to add a new line containing GATEWAY=10.0.10.1 to the /etc/sysconfig/network file on each of 32 slave nodes in a cluster.I read this post on how to insert a line with sed.This works for me to add a line to a local file:  sed -i.bak -e \$aGATEWAY=10.0.10.1 test/test1This works for me viewing a file on node 32:  pdsh -w n032 cat test/test1This fails for me trying to add a line to a file on node 32:  pdsh -w n032 sed -i.bak -e \$aGATEWAY=10.0.10.1 test/test1With this error:n032: sed: -e expression #1, char 2: extra characters after commandpdsh@admin: n032: ssh exited with exit code 1I own the file that I'm trying to change:  pdsh -w n032 ls -al test/test1The above command shows that I own it and have read and write (rw) permissions.Why does it fail?
SED and PDSH: adding a line to a file on a slave node in a cluster
sed;cluster;pdsh
Ok try with this command line:pdsh -w n032  sed -i.bak -e '\$aGATEWAY=10.0.10.1' test/test1;With ssh it works. If it works locally (on the nodes) the simple command, it should work this line too.When you try without quote ', the shell locally (on the current shell on entry computer) will expand and transform for the node the line in:sed -i.bak -e =10.0.10.1 test/test1and you will read that error.Maybe you can find interesting e.g. this chapter or this other. 