I have a list of about 10 servers that I would like to change a string in all 10 servers.
I have written a script that looks at the file and with a loop and should use perl -i -pe to change the line /opt/nimsoft/bin/niminit "" "start" to #/opt/nimsoft/bin/niminit "" "start" (add a # to comment out)
oldstring = /opt/nimsoft/bin/niminit "" "start"
newstring = #/opt/nimsoft/bin/niminit "" "start"
I am having trouble escaping the /, I have tried \ and \Q and \E. Any ideas?
for i in `cat $file`
do
echo "Disable application on startup"
oldstring=start /opt/nimsoft/bin/niminit "" "start"
newstring=#start /opt/nimsoft/bin/niminit "" "start"
ssh -t $i sudo perl -p -i -e 's/oldstring/newstring/g' /etc/rc.tcpip
# /etc/rc.tcpip:start /opt/nimsoft/bin/niminit "" "start"
echo "==============================================="
done