We help IT Professionals succeed at work.

bash ksh

lolaferrari
lolaferrari asked
on
I have to change ip addresses on various files on many hosts. Is there a script anyone has whereby i would change the values based on hostname. so presuming the files are the same for all hosts but each host is going to have different values replaced for those files.

file1=/opt/apache/httpd.conf
file2=/etc/ssh/sshd_config
file3=/opt/appname/file3

Comment
Watch Question

You have to be a little more specific.  If you already know the which files you would modify, then you have to show how the line appears so that I could suggest a script to modify those values for each host.
If you don't even know which files, then I will need to know the Linux distribution in which you would like to change the IP addresses.
ozo
Most Valuable Expert 2014
Top Expert 2015

Commented:
Can you have a configuration file on each host which defines the values for that host, which your script will then use?

Author

Commented:
i would be changing the 3 files listed on all hosts the same files will be changed with the same change