Sure,
I am assuming you are using linux. You achieve this with ssh and a for loop. This is a bash script.
Give this a try. Please add the server names in place of server1 and server2 if you do not have NIS or the /etc/hosts files showing them, add the servers IP addresses in that spot. You can also setup ssh keys to take care of typing the passwords each time the script is invoked.
Create a file with the text below in it.
Code:
Prompt>vi filechange.sh
Add the code below after you change the server names to your servers or IP addresses. Make the script executable:
Code:
Prompt>chmod +x filechange.sh
You will need to be root for all of this, or use the sudo call before each command.
Now execute with:
Code:
Prompt>/path/to/script/filechange.sh
PHP Code:
#! /bin/bash
for server in "server1" "server2" ; do
ssh $server echo "text that you want to change" >> /path/to/file/ ; done
This solution will only inject text into a file. If you need to do a replace of some sort you can use something like this:
PHP Code:
#! /bin/bash
for server in "server1" "server2" ; do
ssh $server echo /path/to/file | sed -e 's/replace-text-with/new-text-string/g' ; done
Be careful with the sed -e option cause this will change the file on the fly. And there will be no backup. Be sure to back up all files before trying any of this.
Also please give a bit more detail in regards to what you need to edit or change on the files. I can taylor the script to your needs. As always this is just my suggestion. There are many other ways most likely.
Jaysunn